Page 3 of 3

Posted: Tue Aug 21, 2007 1:06 am
by pcmattman
MessiahAndrw wrote:Then don't use MFC. You can use the C-headers of the Win32 SDK if you want.
I don't use MFC (have used it before though). Just making a point.
MessiahAndrw wrote:I always hear people saying "MFC is evil". I haven't used MFC yet, but after looking at a few source examples, it doesn't really seem any worse than any other C++ GUI library?
Message maps that can't be modified via the source editor because doing so will stop your application from compiling? Absurd.
MessiahAndrw wrote:You create an object, set it's position, add the control to a parent control (the window), and add an action to call when you click it. How much simpler could you have it?
That's just a part of it. MFC is really quite bloated - you can write your own MFC-like class system that works better than MFC.

Posted: Tue Aug 21, 2007 1:42 am
by JamesM
I'm not M$ bashing (I used MFC for quite a while) but MFC is really quite poorly designed.

As pcmattman said, the messagemaps cannot be modified at runtime, which all other libraries' (GTK, Qt) can.

Also (although this is really a win32 issue, as mfc is just a class wrapper library) I found plenty of, uhh, 'features' in some of the more advanced functions of control classes.

And just don't get me started on MFC's method of implementing SDI/MDI...

Posted: Tue Aug 21, 2007 5:04 am
by os64dev
You create an object, set it's position, add the control to a parent control (the window), and add an action to call when you click it. How much simpler could you have it?
How about i visually design the GUI and add the code it needs to execute. Like NextStep or VB.

Posted: Tue Aug 21, 2007 5:19 am
by Solar
Erm... that's a feature of the IDE, not the language. In fact, I did just that (visually designing a GUI and adding the code parts it needed to execute) using C++/VisualStudio during an internship a couple of years ago.

Posted: Tue Aug 21, 2007 8:45 am
by JamesM

Code: Select all

agree("Solar");

Posted: Tue Aug 21, 2007 10:10 am
by binutils

Code: Select all


char jerryleecooper[]={'i','love','c'};

/*binutils luv c too*/
agree_func(void (*func)(char *, unsigned int));

BOOST_FOREACH(char i, jerryleecooper)
{
    agree_func(jerryleecooper_point) += atoi(i);
}

Posted: Tue Aug 21, 2007 11:07 am
by JamesM
char jerryleecooper[]={'i','love','c'};

Code: Select all

Syntax error: line 1: unrecognized character literal: 'love'
agree_func(jerryleecooper_point) += atoi(i);

Code: Select all

Error: line 3: LHS of assignment must be lvalue.

Posted: Tue Aug 21, 2007 1:20 pm
by os64dev
Solar wrote:Erm... that's a feature of the IDE, not the language. In fact, I did just that (visually designing a GUI and adding the code parts it needed to execute) using C++/VisualStudio during an internship a couple of years ago.
I am being misunderstood. I made the remark to the question: how much simpler could you have it? The IDE can make the whole GUI code i don't need to write a single line for that, which NextStep did btw. However i need to write the functional code. So ideally you do not need to write a single line of code for GUI development, only drag/drop and set properties. That in my world is simpler.

Posted: Tue Aug 21, 2007 5:06 pm
by AndrewAPrice
JamesM wrote:

Code: Select all

agree("Solar");
We have to do it the MFC way.

Code: Select all


IFORUM forum = GetForum("http://www.osdev.org/phpBB2/","OS Development");
GetForum.Connect();
ITHREAD thread = GetThread(forum ,13877);
IUSER user = GetUser(forum, 2091);
IPOST post = GetPost(thread, 103897);
IUSER me = GetUser(forum, 3781);
IAGREEMENT agreement = CreateAgreement(post, me);
agreement.Begin();

while(!agreement.Completed())
{
    agreement.ProcessByte();
}

agreement.End();
agreement.Disconnect();
agreement.Dispose();
me.Dispose();
user.Dispose();
post.Dispose();
thread.Dispose();
forum.Disconnect();
forum.Dispose();
EDIT: I found a possible bug. If I don't call Disconnect() before I call Dispose() it will delete the users, posts, and threads from the forum.

Posted: Tue Aug 21, 2007 5:14 pm
by AndrewAPrice
os64dev wrote:
Solar wrote:Erm... that's a feature of the IDE, not the language. In fact, I did just that (visually designing a GUI and adding the code parts it needed to execute) using C++/VisualStudio during an internship a couple of years ago.
I am being misunderstood. I made the remark to the question: how much simpler could you have it? The IDE can make the whole GUI code i don't need to write a single line for that, which NextStep did btw. However i need to write the functional code. So ideally you do not need to write a single line of code for GUI development, only drag/drop and set properties. That in my world is simpler.
No GUI designer is perfect. Imagine you spent days working on code that gets called when you click the button. Now imagine you accidentally deleted that button and the GUI designer deletes the OnClick function. Oh no!! :shock: Can I reload? No, it auto-saved!! :shock: How about I try clicking Undo... It undid my GUI actions but not my code :shock: NOOOOOOOOOOOOOOOOOOOOOOO

A smartly designed GUI program could solve these problems by not actually putting any code in the OnClick functions besides calling another function.

(A smart programmer would make backups. But these things always happen after you've done major changes and just about to do the next backup.)

Posted: Wed Aug 22, 2007 8:35 am
by JamesM
I am being misunderstood. I made the remark to the question: how much simpler could you have it? The IDE can make the whole GUI code i don't need to write a single line for that, which NextStep did btw. However i need to write the functional code. So ideally you do not need to write a single line of code for GUI development, only drag/drop and set properties. That in my world is simpler.
I don't see your point. Visual studio creates MFC apps with drag'n'drop, exactly as you describe. The point is that the IDE is completely seperate from the library (the same Visual Studio gui designer can create MFC, win32, .NET, etc interfaces).

Posted: Wed Aug 22, 2007 9:08 am
by Pype.Clicker
AJ wrote:I am a little concerned about how much c++ hides from the programmer though
I haven't done any kernel-level C++ thing so far (well, i'm far from being a wizard at C++, at first), but there are a couple of things i've gathered from my C++-on-nintendoDS that would make me think twice before starting to port Clicker to C++

1. C++ initialization/finalization of your program can quickly become very complex. Probably a good BareBones++ would help, but simply having your global constructors called (and being sure they're called at the proper place in kernel initialization) isn't trivial.

2. C++ objects and classes (and classes' vtable) remain quite opaque and are less debugging-friendly (unless you make sense of dwarf annotations, maybe)

3. objdump -drS nicely interleaves C code and machine code, even at high optimisation levels. Doing the same on a C++-generated .o will leave you clueless at best on what machine code corresponds to what source lines.

Now, it's all a matter of preferences, personal expertise and all the like, anyway.