[comp.lang.c] const struct -- what does exactly mean?

berg@physik.tu-muenchen.de (Stephen R. van den Berg) (06/27/91)

Suppose I declare the following (in ANSI-C, what else):
----------
struct hello {char*a; char**b;};

const struct hello var;
----------
What does that mean?
Which of the following 'var's have I actually declared:

1. struct {char*const a; char**const b;} var;
2. struct {const char*const a; const char*const*const b;} var;
3. struct {const char*a; const char**b;} var;
4. none of the above, the 'const struct hello var' declaration is illegal.

My bets are on answer number 1, but what is your opinion?

(And yes, answers 1 till 3 are VERY distinct answers, to any conforming ANSI C
compiler that is).
--
Sincerely,                                berg@messua.informatik.rwth-aachen.de
           Stephen R. van den Berg.       berg@physik.tu-muenchen.de

"And now for something *completely* different!"