Richard Heathfield ha scritto:
> cr88192 said:
>
> <snip>
>
>> now, I usually code in notepad,
>>
>
> Oh dear. :-)
>
Oh dear dear :-)
>> which has inflexible 8-space tabs, so
>> usually I use this.
>> if the tab space is adjustable, usually I like 4 space tabs.
>>
> And IMO 3 is too many. Vive la difference!
>
>
> You forgot <stdio.h>
> You meant argc.
>
A type , may be...
> If argc is 0, the behaviour is undefined. If it is >= 1, argv[0] must
> represent the program name in some way, but need not be a string
> representing the invocation name for the program. It could even be a
pid!
>
argc must be 1 (the program name ia always passed as argument), by
standard.
But, yes, it is best to check it...
>> return(-1);
>>
>
> This has no ****table meaning (and the parentheses are redundantly
> superfluous).
>
I'm not agree, it' more readable.
>>
>> fd=fopen(argv[1], "rb");
>> ...
>> return(0);
>>
>
> Again, the parentheses are superfluously redundant.
>
Question of style: for me it is better to place parentesis around the
returned value.
What about an horrible return like this one ????
return a*32 / b + c - d * e / oh_my_good ;
> 0 is fine - it means success.
>
>
Ok, it's a standard value
> A -1 return value has no de jure meaning in C (which is, at least, in
> keeping with the better kinds of tradition - if we knew why we did them,
> they wouldn't be traditions!).
>
> To indicate failure ****tably, use EXIT_FAILURE.
>
:-)
brix


|