Xref: news2.mv.net comp.os.msdos.djgpp:4902 From: Tom Wheeley Newsgroups: comp.os.msdos.djgpp Subject: Re: Beginners srand error Date: Wed, 12 Jun 96 21:48:55 GMT Organization: City Zen FM Lines: 68 Message-ID: <834616135snz@tsys.demon.co.uk> References: <9606052005 DOT AA28816 AT falcon DOT cc DOT ukans DOT edu> Reply-To: tomw AT tsys DOT demon DOT co DOT uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <9606052005 DOT AA28816 AT falcon DOT cc DOT ukans DOT edu> halibut AT falcon DOT cc DOT ukans DOT edu writes: > > > >void main, anyone? > > > > As much as I'd like to, I've already said my piece on the subject. > > I could find the original posts and copy them, if you'd like? ;) > > > > Well, maybe just once... > > > > void main() is BAD PROGRAMMING! BAD! Go sit in the corner for 30 > > minutes! :-P The correct definition for main is: > > > > int main( void ) > > > > if you don't need command-line arguments, or > > > > int main( int argc, char *argv[] ) > > > > if you do. Screw traditional C. > > > Well, I'd like to see the original posts why void main() is bad > programming. I'm grateful to learn all my errors; there have been > quite a few in the one week I've been studying C. Because void main is expressly undefined in the ISO C Standard, and so you cannot rely on the behaviour of the generated code. Probably due to the misguided advice of Mr Schildt, many people use void main to stifle the common compiler warning of main not returning a value (which results in an undefined exit code, but defined behaviour). Chances are every compiler will cope with void main, but *you cannot rely on that!* Undefined behaviour can result in absolutely anything, including what you expect. > I have another question concerning make files. > > Either of my Dos text editor, edit or e, will not seemingly store > the tab character that is needed at the beginning of a make file > command line. I had to resort to using a windows app. Is there > a way to configure either of these editors so I can write make files > with them. I don't think so: I corrected lines with edlin! > Another question is to everyone: what is the best way to view > and edit all of your program files and still have access to dos > for the command line to make or run (aside from Rhide). What I've been doing > is opening files from windows with notepad and then editing them, but > the limitation of this is I can't save the changes easily. What is > the best editor or editor of your choice to do this? (Also is there a djgpp > command line option to make and run at the same time?) I use doskey and Edit. Edit is a very poor editor for C programming, but I would think notepad is even worse! Unfortunately I have to exit to compile, but with doskey I can open them up easily. Also Alt-f,x ensures every file is saved. Why can't Edit have Shell to DOS! :-( Doskey makes typing those gcc command lines very easy for small programs, when you don't want to make a Makefile. ..splitbung -- * TQ 1.0 * The 'Just So Quotes'. "Hey, imp!" shouted Vlad, the imp hailer.