Should I convert FORTRAN code to C?
Greg Comeau
greg at csanta.UUCP
Mon Jun 13 23:15:12 AEST 1988
>> Gee, I just tried compiling x = +5; it worked.
> i = +5;
>comments:
> "junk.c", line 5: syntax error
>It may very well work in other compilers, and will probably be added in
>the new standard, but is not there now.
If an old compiler accepts this it is probably just being lazy for some reason.
Since C does not have a unary plus, it should be a syntax error. Note that
the ANSI draft does allow a unary plus now though since "hey, there's a unary
minus so let's at least be consistent". Also, at one time ANSI did apply
a binding characteristic to the unary plus applied to parenthised expression
(say: a + +(b + c) if I recall), but that has since been withdrawn.
More information about the Comp.lang.c
mailing list