2018-02-01 -- Writing a C Compiler #27

Опубликовано: 06 Апрель 2026
на канале: AltComp126
18
0

Here we have corrected a strange error where our compiler ends up writing a substring of the line read instead of the intended string start offset for the line start.

The instant solution we used to fix it here was to switch to use the group of buffer/offset variables, from globally declared, to locally declared.

It seems to be a bug in the GCC from MinGW (6.3.0-1).

But it seems that using locally declared variables is more portable across compilers than globally declared ones. It can be a provisional solution we should explore fully while implementing our compiler, specially the fact of confusing a compiler because of using local/global variables that are heavily used, which can become more critical if local/global variables have the same names due to compiler bugs.