First C compiler ported to GCC
11–20 of 90 posts
Re: First C compiler ported to GCC
#12If the first C compiler was written in C... how could it be first C compiler? How could you compile the first C compiler?
† Or maybe some variant of BCPL -- I'm not exactly sure how functionally different the two were.
Re: First C compiler ported to GCC
#13If the first C compiler was written in C... how could it be first C compiler? How could you compile the first C compiler?
Re: First C compiler ported to GCC
#14If the first C compiler was written in C... how could it be first C compiler? How could you compile the first C compiler?
Re: First C compiler ported to GCC
#15"The compiler runs only in 32 bit mode as the original code assumes that the pointer size and word size are the same." ... which was um, 16-bits
Re: First C compiler ported to GCC
#16"The compiler runs only in 32 bit mode as the original code assumes that the pointer size and word size are the same." ... which was um, 16-bits
On a PDP-11 int would have been 16-bit. On x86 32 bits. But on x86_64 int is 32 bits but pointers are 64-bit. The easiest way to retain the original assumption with minimal changes to the historical source code while targeting a modern CPU is to compile in 32-bit mode.
Re: First C compiler ported to GCC
#17Earlier quoted context omitted.
"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.
Still a better type system than Twilight.
Re: First C compiler ported to GCC
#18If the first C compiler was written in C... how could it be first C compiler? How could you compile the first C compiler?
Bootstrapping https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
From how I read it, it is not capable of bootstrapping itself, and an earlier C compiler in BCPL existed, this is the first C compiler written in C itself.
Re: First C compiler ported to GCC
#19If the first C compiler was written in C... how could it be first C compiler? How could you compile the first C compiler?
Re: First C compiler ported to GCC
#20Did 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.