Mail Archives: djgpp/1996/08/02/15:06:01
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 -