Migrating Mattise to C++

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post 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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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...
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post 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.
Author of COBOS
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post 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.
Every good solution is obvious once you've found it.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Code: Select all

agree("Solar");
User avatar
binutils
Member
Member
Posts: 214
Joined: Thu Apr 05, 2007 6:07 am

Post 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);
}
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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.
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post 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.
Author of COBOS
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post 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.
My OS is Perception.
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post 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.)
My OS is Perception.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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).
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Post 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.
Post Reply