Live data from Hacker News

First C compiler ported to GCC

github.com

1–10 of 90 posts

Re: First C compiler ported to GCC

#4

Did this compiler really support "auto" as a variable type, as seen in example fizzbuzz ?

"auto" probably is the storage class, it tells what kind of variable this is. Automatic as opposed to "register" which would force the variable to be a register, or "static" or "extern".

The type is not given at all, I think by default it would be "int".

Re: First C compiler ported to GCC

#7

Did this compiler really support "auto" as a variable type, as seen in example fizzbuzz ?

"auto" in c is a storage class specifier, like "register", "extern" or "static".

https://en.cppreference.com/w/c/language/storage_duration

It was considered pretty useless by most, so c++11 recycled the keyword to mean something different.

Re: First C compiler ported to GCC

#8

Did this compiler really support "auto" as a variable type, as seen in example fizzbuzz ?

"auto" probably is the storage class, it tells what kind of variable this is. Automatic as opposed to "register" which would force the variable to be a register, or "static" or "extern". The type is not given at all, I think by default it would be "int".

> The type is not given at all, I think by default it would be "int".

Yep, this is called the "implicit int" rule, and it was specifically outlawed[1] by C99 and onward.

[1] https://herbsutter.com/2015/04/16/reader-qa-why-was-implicit...

Re: First C compiler ported to GCC

#9

Did this compiler really support "auto" as a variable type, as seen in example fizzbuzz ?

"auto" probably is the storage class, it tells what kind of variable this is. Automatic as opposed to "register" which would force the variable to be a register, or "static" or "extern". The type is not given at all, I think by default it would be "int".

One of the unusual things in this early version of C is that "int" can be used for any word-sized value, including pointers. The type system was very loose.
Post reply on HN