Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Questions, questions, too many questions...

Reply to topic
Author Message
  • Joined: 03 Sep 2007
  • Posts: 352
  • Location: Canada
Reply with quote
Questions, questions, too many questions...
Post Posted: Fri Jul 07, 2000 12:53 am
Hello. Finaly got myself a programming book for C. Looks very well written (by an old fart named Ivor Horton). The book sez that I need a compiler... Any of you guys know a good one (free or not, got my eye on codewarrior 5 but it costs 600$ canadian so it's out of the question)? And, if I may Bug you guys from time to time with "stupid" beginner questions (although at first not very S8 oriented)... Thanks in advance.
  View user's profile Send private message
Consolemu
  • Guest
Reply with quote
Post Posted: Fri Jul 07, 2000 3:20 am
Man, I'd say your best best is to head to an Electronic Botique, Best Buy, or some type of computing store and look for something called the C Programming Starter Kit. I don't remember the exact price but it's less than $50 bucks and you get a full registered version of Borland C++. It an't the most flexable compiler but it's cheap, easy to use, and automatically optomizes your programs so they run fast. It's perfect for writing scratch code in pure DOS and stuff but I don't suggest getting into it's Windows portion. It's not difficult to learn but it's different from the rest. I don't know why but it's like a whole new language to learn. It's different from the Microsoft MFC/SDK format and that's why many people shun it.

Chris :o)
 
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Post Posted: Fri Jul 07, 2000 5:04 am
Quote
> Man, I'd say your best best is to head to an Electronic Botique, Best Buy, or some type of computing store and look for something called the C Programming Starter Kit. I don't remember the exact price but it's less than $50 bucks and you get a full registered version of Borland C++.

You can get a more recent version for -free- from borland online. It's about an 8 meg download, and compiles windows executables stuff. What seperates it from the 'Borland Builder' thing is the like of an Integrated Developer's environment, and no Turbo Assembler... not that you'd really need the latter just yet.


Quote
> It an't the most flexable compiler but it's cheap, easy to use, and automatically optomizes your programs so they run fast.

Most compilers will, the only exception I can think of is Visual C++ standard edition, it's mostly the same as the Pro Edition, except the compiler is non-optimizing. Cute, Microsoft, real Cute.

Quote
> It's perfect for writing scratch code in pure DOS and stuff but I don't suggest getting into it's Windows portion. It's not difficult to learn but it's different from the rest.

???

Quote
>I don't know why but it's like a whole new language to learn. It's different from the Microsoft MFC/SDK format and that's why many people shun it.

Ah, that's right, they have their own Template Library, in answer to MFC.

However, the Platform SDK is the same on all windows compilers, and I'd really recommend not using Microsoft Foundation Classes. It's proprietary to Visual C++ for one thing, and depending on it can limit your understanding of the Win32 API.

My own recommendations (I've probably tried them all):

Free DOS Compilers:
DJGPP - The only really choice these days. MSDOS port of the GNU C and C++ compilers, nice optimizing compiler, always being maintained and updated, large user base. Add to that RHIDE (a nice text based Integrated Developer's Environment [hereforth IDE]) and the Allegro Library, and you're ready to take on the [dos] world.
It's apparently possible to make windows executables with DJGPP and an add-on package, but I havent' looked into it.
(www.delorie.com)

Free Windows Compilers:

LCC-Win32: A nice C Compiler and IDE from a guy in France. Fast output, support for most of the Windows API (sometimes it doesn't get the latest versions of DirectX and other components, but it's being worked on). Doesn't do C++, which is why I've moved away from it, but it's a blazing fast compiler. It doesn't compiler DOS executables... though it does compiler windows console applications (you'll learn the differences can be tricky... don't try funky DOS tricks like changing the display mode with 'int' commands, it won't work). It's still having growing pains, so you'll come across an irritating glitch every so often, but if you bring it to the author's attention he'll nearly always address it quickly. Comes with a graphical debugger, but I've never had much luck getting it to run.
[www.cs.virginia.edu/lcc-win32]

Borland C (free version 5.5): The same one they sell,as talked about above. It's only a compiler, though, no IDE, so you have to run it all at the command line. A little daunting at first. Does all your windows stuff. Also does c++, a modern good implementation. Compiles a bit slower than LCC, especially in C++, but C++ is a complicated language anyway.
[www.borland.com, or maybe www.inprise.com/borland]

MingW: Another commandline based compiler. Windows port of GCC (GNU C and C++), one of two (the other, CygWin, doesn't add anything you'd be interested in). Actively developed, decently fast compiler, supports all standard windows libraries like the above two. If you want an IDE (you probably do), download Dev-C++, which comes with Mingw and sets it up for you. Dev-C++ is a little glitchy, as it too is being developed, but they tend to fix bugs as they're brought to their attention.
[www.mingw.org (maybe?), or www.bloodshed.net for Dev-C++]

Commercial packages:

Microsoft Visual C++:
If you're ready to drop some pesos, Microsoft's beast of a developer's kit probably -is- worth the money, if only to be working with the industry standard. The only compiler to support their own MFC, which is of questionable value. Has a --faaaast-- fast fast compiler, good debugging, lots of online help, is always the first thing to support the latest technologies (new directx's, and other libraries and add ons), is what most commercial software is written in, and gives you lots of nic ways to manage your code. Contains some extraneous things that can be ignored.
The standard edition runs around $150, and is like to $400-$450 pro edition, except for the optimization level of the output and one or two small details.
Microsoft always makes liscencing issues sound so spooky, but by and large can be ignored.

Borland builder:
Like Visual C++. I'm not sure how much like it is, really. Falls short in some places, excels in others. Cost is also high, and as mentioned above is built on Borland C/C++ which is available for free.


Codewarrior:
Um, no.
Codewarrior rules the Mac Development world, and is in fact a very good mac developer's environment. The windows version is an afterthought. Avoid.



As mentioned above, DJGPP is the only real DOS option (and that's kind of a nice thing, not having to make a choice).
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Post Posted: Fri Jul 07, 2000 5:11 am
Quote
> Hello. Finaly got myself a programming book for C. Looks very well written (by an old fart named Ivor Horton). The book sez that I need a compiler... Any of you guys know a good one (free or not, got my eye on codewarrior 5 but it costs 600$ canadian so it's out of the question)? And, if I may Bug you guys from time to time with "stupid" beginner questions (although at first not very S8 oriented)... Thanks in advance.

First, check the book for it's earlier examples.

The first 'Hello World!' program should look something like this.



int main()
{
printf("Hello World!
");
return 0;
}



if it begins "void main()", return the book. That's always a sign of a poor book.

also:
NOT codewarrior NOT codewarrior NO.

Right now I'd recommend you go with DJGPP or LCC-Win32 (or dev-c++). Both are nice free compilers, and I'd recommend you get to know your own programming needs before you sink down money on a commercial compiler.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Sep 2007
  • Posts: 352
  • Location: Canada
Reply with quote
Post Posted: Fri Jul 07, 2000 8:29 pm
Quote
> The first 'Hello World!' program should look something like this.

>

> int main()
> {
> printf("Hello World!
");
> return 0;
> }

>


> if it begins "void main()", return the book. That's always a sign of a poor book.

Well the "hello world" does start with Void main(). Why is it bad? I've chosen this book because, in all the books that I saw this one had every program example disected and explained in a clear manner... I could acctualy understand these explanations as opposed to the other books which had less explanations (I was there for two hours searching for a good one). What is the defference between void main() and int main() ? And, is it easyer to code for dos or windows? Any drawbacks using dos instead of windows (or vice-versa)? Thank you.
  View user's profile Send private message
  • Joined: 03 Sep 2007
  • Posts: 352
  • Location: Canada
Reply with quote
Thanks guys ! *nt*
Post Posted: Fri Jul 07, 2000 8:31 pm
*nt*
  View user's profile Send private message
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Post Posted: Fri Jul 07, 2000 9:33 pm
Quote
> > The first 'Hello World!' program should look something like this.

> >

> > int main()
> > {
> > printf("Hello World!
");
> > return 0;
> > }

> >


> > if it begins "void main()", return the book. That's always a sign of a poor book.

> Well the "hello world" does start with Void main(). Why is it bad?

It is bad because the book is being written by a person who either does not fully understand Standard ANSI C or is perfectly willing to defy the standard because it just happens to run on his compiler.
If it's the former, it goes back to the old addage "Tho who can, do. Those who can't, teach" (no, not universally true of course, but...). The guy may be the type who learned a bit of C, never learned enough to be a good programmer, but learned enough to write a book about (which he did because he could never hold a job in programming but was good at bullshitting a publisher into printing his book). This may not be the case, either, but there have been quite a few books written that way, including the infamous C for dummies, which teaches all sorts of nasty non portable and just plain poor practices as 'Standard C'.

If it's the latter, then the author may have his own ideas about standard C and feel that the official ANSI standard is meaningless in the face of what funny tricks he's come up with, and all that matters is what seems to work on his compiler.
The tricky thing about the C standard is that is specifies many things that are 'undefined', that is, usage of C features in a way that may work on some compilers and not on others, but should -never- be depended on. You will likely deviate intentionally from the standard in your career as a programmer, but you should always be aware what you're doing and why you had to do it.

in the long term, the void main() thing doesn't really matter by itself, most compilers will accept it, or accept it but issue a warning. But there's absolutely no reason to teach someone to do it the wrong way. And there's no telling what things he's telling you to do that are -definately- wrong. A minimalist do nothing C program should be no less than:
int main()
{
return 0;
}

Whether the '0' will be used or ignored depends on the OS and compiler implementation. (MS DOS uses it thought it's often ignored, and Windows programs definately use it, although they don't generally have a 'main()' anyway) Zero means success.

Quote
>I've chosen this book because, in all the books that I saw this one had every program example disected and explained in a clear manner... I could acctualy understand these explanations as opposed to the other books which had less explanations (I was there for two hours searching for a good one).

Hmm. Maybe I should look for that book at the local shop and see if the void main() thing is an anomoly.
If french is more comfortable for you, I'm sure some of the most recommended C books have been translated into french (and I know Charles Petzold's absolutely fabulous Programming Windows has been, you may wish to keep your eye out for it for when you've learned C and want to write proper windows programs (with windows and menus and all the good stuff).).

Quote
> What is the defference between void main() and int main() ?

As explained above, one is non standard (and incorrect) and one is standard.

Quote
>And, is it easyer to code for dos or windows? Any drawbacks using dos instead of windows (or vice-versa)? Thank you.

In the short term, while you're learning to program C with the standard libraries alone (everything coming into and out of the console), it actually will make little difference, the compiled programs should behave the same after having been compiled for either dos or windows (that's the STANDARD part of it), so long as you stick with the standard libraries and don't do anything undefined.

When you want to make into 'implementation specific' features, that's when you must choose between windows and dos. The advantage of a windows compiler is that you can access to all the windows specific features like:

-Networking
-Being able to create windows on the standard windows desktop
-storing program settings in the registry.
-long filenames (supported to some degree in DOS I think, if available).
-using DirectX (to allow you to use hardware acceleration on all graphics cards, use all sound cards and joysticks that windows supports, including USB devices, not just the ever diminishing number that provide dos compatibility).
-Take advantage of windows drivers (your programs won't be stuck with 320 x 200 VGA mode 13h if the user doesn't have VESA 2.0 support for their video card, for instance).
-Multitasking and Multithreading (in pure dos you can't multitask (TSR's excepted), and multiple dos programs running on windows can't reliable communicate with eachother) (multithreading is a bit harder to explain.. it can be simulated in dos but it's no small matter at all).
-Access to windows system settings (so your text can appear in the font the user likes for all his windows applications, and so your windows will be in the same color as your desktop theme if you want, many more things like that).
-Dos programs don't get windows messages (like 'Please Quit this process' when the close box is clicked.)
-Windows can keep you from having to reinvent the wheel with such things as graphic user interfaces.
-Much more that I'm not thinking of at this moment.

Disadvantages:
-Your program won't run on pure dos machines (there are a few out there).
-Older and slower PC's seem to run DOS games and emulators faster than windows native-directx games and emulators.
-you can't use so many of the silly old VGA tricks in windows applications, not that you're really want to these days.
-Windows can be more difficult to code with, especially since the allegro library lets you get up and slinging pixels in very few lines of code, windows applications have to be written in that special windows way so that it can receive windows messages and react properly.



Hopefully that's enough to help you make your decision.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Sep 2007
  • Posts: 352
  • Location: Canada
Reply with quote
Re: Hummm.....
Post Posted: Fri Jul 07, 2000 11:07 pm
The book is called : Beginning C by Ivor Horton (2nd edition), published at WROX ( http://www.wrox.com/ ). it's an old one (1997) but it seems to be fine, at least for now. Of course this book will not be the only book I will buy and if using int main() instead of void main() is better that i'll simply switch it (if it's posible of course). i'll check for those Charles Petzold books as you obviously seem to know your way around programming... I think i'll go with windows, planning for the future as dos is sadly being forgotten :( oh well...

Btw, did you guys visit this page?

http://www.codeplay.com/

This compiler (VectorC) seems really good...
  View user's profile Send private message
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Re: Hummm.....
Post Posted: Sat Jul 08, 2000 6:33 pm
Quote
> The book is called : Beginning C by Ivor Horton (2nd edition), published at WROX ( http://www.wrox.com/ ). it's an old one (1997) but it seems to be fine, at least for now. Of course this book will not be the only book I will buy and if using int main() instead of void main() is better that i'll simply switch it (if it's posible of course). i'll check for those Charles Petzold books as you obviously seem to know your way around programming... I think i'll go with windows, planning for the future as dos is sadly being forgotten :( oh well...


You can always do both, for a little while.
MS doesn't make it easy to get a window up and let you stard throwing pixels on it at will.
About the Horton book.. from what I've dug up on it, the void main() thing gets a lot of complaints, but that's about the only really anti-standard thing he does. The book seems fairly well written, but really glosses over some important parts of C (particularly pointers), and he sort of loses his patience in later chapters, not taking the same care to explain things as he did in the beginning. This is all second hand knowledge of course.
Go ahead and read it, but be prepared to buy other books to supplement your knowledge (a good reference is nice to have).

The Petzold book is really the only good way to learn windows programming, in my opinion.

Quote
> Btw, did you guys visit this page?

> http://www.codeplay.com/

> This compiler (VectorC) seems really good...


...from their own reviews, yes.
IT might be handy to have to compile certain time-critical parts of your source code and link it in with output from another compiler, but I have strong suspicions that it's definately a work in progress being sold as a commercial product, and offers an incomplete implementation of a windows compiler. And it's a little expensive for something that doesn't do C++.

As mentioned before, don't buy any compilers yet, go with the free ones until you've developed yourself well enough along to see what sort of needs you have (good debugging, the fastest output possible, MFC support, C++, the very latest MS libraries...) and what tradeoffs you're willing to make.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Sep 2007
  • Posts: 352
  • Location: Canada
Reply with quote
Re: Hummm.....
Post Posted: Sun Jul 09, 2000 6:06 pm
Quote
> About the Horton book.. from what I've dug up on it, the void main() thing gets a lot of complaints, but that's about the only really anti-standard thing he does. The book seems fairly well written, but really glosses over some important parts of C (particularly pointers), and he sort of loses his patience in later chapters, not taking the same care to explain things as he did in the beginning. This is all second hand knowledge of course.
> Go ahead and read it, but be prepared to buy other books to supplement your knowledge (a good reference is nice to have).

Since the book is aimed at the beginners i'll stick with it but I WILL buy some "intermediate" books afterwards... but for now I like his "compile every example you've learned so far" approach... I can now understand parts of any C source code I look at !

Quote
> The Petzold book is really the only good way to learn windows programming, in my opinion.

Gotcha ;)

Quote
> > Btw, did you guys visit this page?

> > http://www.codeplay.com/

> > This compiler (VectorC) seems really good...

>
> ...from their own reviews, yes.
> IT might be handy to have to compile certain time-critical parts of your source code and link it in with output from another compiler, but I have strong suspicions that it's definately a work in progress being sold as a commercial product, and offers an incomplete implementation of a windows compiler. And it's a little expensive for something that doesn't do C++.

> As mentioned before, don't buy any compilers yet, go with the free ones until you've developed yourself well enough along to see what sort of needs you have (good debugging, the fastest output possible, MFC support, C++, the very latest MS libraries...) and what tradeoffs you're willing to make.

You're right. I've tried LCC-WIN32 and are very happy with the results. Compiling with it gives me great results with all the book examples i've compiled so far...
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!