Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Eckel pg 358: compiler symbol table and aggregates

13 views
Skip to first unread message

Veek M

unread,
Jan 9, 2017, 1:18:26 AM1/9/17
to
Basically he says:
'a compiler will not be sophisticated enough to keep an aggregate in its
symbol table'

surely if it's a local aggregate, that's a SP operation and if it's
global then it's in the file.o

He's basically trying to make the point that a 'const' can be used with
aggregates (array, struct, union) but only for immutablity (can't alter)
and NOT for constant folding (compiler substitution).

But a symbol table stores identifiers and type info not the actual value
so I was wondering what he meant by compiler sophistication?

Veek M

unread,
Jan 9, 2017, 1:29:04 AM1/9/17
to
I do understand that he could store simple values (#define equivalent)
in the symbol table and work with that to do simple arithmetic
computations to allocate arrays.

So, const int i = 10; could be defined in ST and never hit the file for
allocation if you obey certain rules (not take an address, don't use
extern for external linkage) but I was hoping someone could shed more
light on 'compiler will not be sophisticated' - hashes and BST are not
all that complicated so.. what does he mean by 'sophisticated'. What
prevents him from allocating an array and indexing it and allowing:

float f[ i[2] ];


0 new messages