www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/02/15:06:01

From: kagel AT quasar DOT bloomberg DOT com
Date: Fri, 2 Aug 1996 14:58:10 -0400
Message-Id: <9608021858.AA05640@quasar.bloomberg.com >
To: orly AT gibson DOT eee DOT upd DOT edu DOT ph
Cc: j DOT aldrich6 AT genie DOT com, djgpp AT delorie DOT com
In-Reply-To: <Pine.SGI.3.93.960803003319.678A-100000@gibson.eee.upd.edu.ph> (message from Orlando Andico on Sat, 3 Aug 1996 00:35:02 +0800 (GMT))
Subject: Re: Compile Errors
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   Errors-To: postmaster AT ns1
   Date: Sat, 3 Aug 1996 00:35:02 +0800 (GMT)
   From: Orlando Andico <orly AT gibson DOT eee DOT upd DOT edu DOT ph>
   Cc: j DOT aldrich6 AT genie DOT com, djgpp AT delorie DOT com
   Mime-Version: 1.0
   Content-Type: TEXT/PLAIN; charset=US-ASCII
   Content-Length: 1280

   On Fri, 2 Aug 1996 kagel AT quasar DOT bloomberg DOT com wrote:

   > 
   > As far as LANDMARK's indentation style, hey that's been my style for over ten
   > years!  But seriously, it is the style promoted in all of the sample code in
   > K&R, do not pummel the newbie for emulating the greats!  (Meaning Brian and
   > Dennis not me.)  He is lining up his closing braces, with the matching opening
   > statement, HE JUST FORGOT ONE and as a newbie was just as likely to miss this
   > with any other indentation/brace position style!
   > 
   >     Argh!  Do I have to go through this again?!?  Please take whatever
   >     disk, manual, or person you got this program from and burn him/her/it
   >     at the stake.  There are only two *correct* ways to define main():
   > 
   >     int main( int argc, char **argv )
   >     Use this when you need command-line parameters.
   > 
   >     int main( void )
   >     Use this if you don't need command-line parameters.
   > 
   > Almost, actually there is a third valid definition for main():
   > 
   > 	int main( int argc, char **argv, char **environment )
   > 

   But what about 

     int main (int argc, char *argv[]) ?

   I use this all the time.. *sob* and about indentation style.. I think the
   best way is not to think about it at all. Get emacs and let the editor do
   the indentation bit for you.

It should be fine but, as I have pointed out before, it is bad style since argv
is a pointer to pointer not pointer to array. There are compilers out there
which SC**W up this construct so your code is less portable.  YES IT SHOULD 
WORK but it don't always.


-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019