Keith Thompson <kst-u@[EMAIL PROTECTED]
> wrote:
> 2. Opening and closing braces appear on lines by themselves.
> Enclosed lines are indented by one level.
> Rarer, but still valid, styles are:
> 3. Like 2, but the braces are aligned with the enclosed lines.
> 4. Like 2, but the braces are half-indented (e.g., by 2 columns).
> I think this is the GNU-recommended style.
> 4.
> int main(int argc, char **argv)
> {
> if (argc != 3)
> {
> fprintf(stderr, "usage error\n");
> return -1;
> }
> double x, y;
> x = strtod(argv[1], NULL);
> y = strtod(argv[2], NULL);
> printf("%.2f\n", y / x);
> return 0;
> }
That's not exactly GNU style, which is like this:
int
main (int argc, char **argv)
{
if (argc != 3)
{
fprintf(stderr, "usage error\n");
return -1;
}
double x, y;
x = strtod (argv[1], NULL);
y = strtod (argv[2], NULL);
printf ("%.2f\n", y / x);
return 0;
}
Andrew.


|