Fred's Tutorial #ALL: Discussion Thread

Started by Edwin Knoppert, August 20, 2007, 10:03:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Edwin Knoppert

1) Most BASIC languages don't support local variable scoping like c does {..}
Therefore a common 'mistake' is to assume the windowproc is poorly constructed due to this 'impact'
If a switch() is combined with {} for each case, local variables and so can be used fine.

2) Using a static in the windowprocedure *will* bite you soon or later.
If this topic supposed to be a lesson of some kind i can surely recommend you not to use globals and statics for your examples.
I know people who can not judge these issues and from my own experiance, poor code remains to be used even if i know better.
just to lazy to improve or just waiting until it explodes or something like that :)

Marc Van Cauwenberghe


I am really intrigued by your statement 1). I have missed using local variables. Could you explain this please (maybe in an other topic)


Paul Breen

I don't know if I am posting in the right place but. . .

I am curious about why you moved from MFC to powerbasic because I am studying MFC to go the other way! I am thinking of using MFC in the "main" program and use powerbasic through dll's


Frederick J. Harris

Hi Paul!

     I've always disliked MFC.  I still do a lot of C & C++ programming but I use my own libraries.  The reasons I dislike MFC are the hugh bloated programs that result, and the architecture (document view) that is imposes on one.  If you don't care about the size of the resulting programs, can live with wizard generated code, and like the MFC Document/View architecture, I'd say use it.  Here just recently my organization received a large MFC program that was recently released, so I know folks are still using MFC.

     In terms of 'ends and means', I guess I'd say the 'means' are as important or even more important to me than the 'ends'.  If I had to choose between producing a simpler application of which I could say I fully understood every line of code, and a more complex one containing auto-generated code some of which might even be over my head, I'd usually choose the simpler one, and hope that while producing it I'd learn something new.  To me the primary beauty of C++ is that it allows you to use some truely interesting features to build up larger code 'objects'.  So I guess I like to keep re-inventing the wheel.  As I said...a matter of ends vs means.

     I guess in my formative years as a coder there was no internet where one could go for help.  I always worked alone and never had access to anyone to whom I could go for help.  I developed a mentality where I had to figure out everything for myself.  Therefore, I tended to stick with more basic and fundamental coding styles that were not several abstraction layers above the 'base', as it were.  That is probably part of the appeal of sdk api style coding.  Once you understand the fundamentals, its really pretty simple.  That's about the best I can do for an answer! 


Paul Breen

I read that mfc was a "thin" wrapper on the win32 so I thought the programs would have little bloat.
(sigh) :'(
I have hopes for freebasic now, just loaded the latest version with FreeBASIC editor and so far I am impressed, it looks like vc++ 6.0 ide. Don't use FBIde, it is a different animal. I hope phoenix will adopt this compiler in time. Looks like a new release every 3-4 months and it is much improved since I first looked at it over a year ago. I have given up on PowerBasic adopting oop, they don't even see the need for projects.

Frederick J. Harris

Interesting that you mentioned FreeBasic.  Couple years ago I looked at it quickly, but didn't really dig too deep.  You say they have an IDE now? 

For quite some time in my 'non-work' hours I've been exploring Linux programming.  Particularly XLib, Motif and most recently GTK+.  I was thinking of getting the latest version of FreeBasic, and seeing if I couldn't convert some headers from some of the aforementioned Linux toolkits/libraries and try to compile some GUI programs with it.  I like the economy of Linux Exes.  Size wise, they're smaller than Windows Exes, at least using XLib or Motif.

Charles Pegge

Freebasic works very well for me, on both Windows and Linux. The exe sizes produced by are similar to PB - they tend to be a few KB more due to slightly larger runtime function groups, and Linux executables are slightly larger than MS EXEs. But in practice the size difference is insignificant.

Paul Breen

Quote from: Frederick J. Harris on April 18, 2008, 04:28:22 AM
You say they have an IDE now? 
Yes, and it is a good one. As I mentioned the one to get is FbEdit. Code folding, resource editor, output window etc.
looks a lot like vc++ 6.0 ide. One click install on xp sp2 was perfect and all sample projects compiled and ran (unlike the $ powerbasic ide's I have tried). It has a code snippet dialog and integrates the win32 help file just like powerbasic ide's
The best thing I thought was the tremendous improvement in the help file for the compiler. It is approaching the powerbasic help file in quality. I have never understood why programming tools are offered with lousy help files, as if a programmer was also a mind reader.