Dimensionality of program code
Era Scarecrow
rtcvb32 at yahoo.com
Fri Jan 18 15:17:50 PST 2013
On Friday, 18 January 2013 at 19:50:06 UTC, Stewart Gordon wrote:
> On 17/01/2013 22:01, Era Scarecrow wrote:
>> // c example, originally isprime and main don't have
>> // return types, defaulting to int instead.
>
> Does the return type of a function still default to int if
> unspecified in current C, either according to the ANSI standard
> or according to most compilers?
For compatibility it does. Functions called without prototypes
(even if they are later in the same file) default to return type
int too. I can't think of any compilers that make it an error
(although they should)
> But Dennis could have easily designed it to use a newline
> instead of a semicolon. Indeed, there are a number of
> programming languages that basically do this.
Maybe, but if you use a newline instead of a semi-colon, then
you can't put multiple statements on the same line; newlines and
spaces are more formatting so they were likely rejected as part
of the separator; That and if you write a very long statement
line (several requirements in an if statement) not being able to
break it up would make for very very ugly code. The preprocessor
being it's own thing used newlines as a separator, to macros you
need to escape newline.
More information about the Digitalmars-d
mailing list