Why didn't ANSI make initialisation consistent ????

Victor Gavin vic at grep.co.uk
Thu Apr 25 00:12:06 AEST 1991


I (after many, many years of C programming) found that I couldn't perform what
I considered to be a reasonable assignment command.

I traced it back to my use of
	char *fred = "bert"
being the same as
	char fred[] = {'b', 'e', 'r', 't', '\0'}


Which made me believe that I could use the following code:

	struct bert { int a, b; }
	struct fred { struct bert *abc; } blip = { {1,1} };

[[ie That the compiler will place the data for the structure into one of the
data segments and then place it's address into the pointer variable.]]


Of course none of my compilers liked this.

Could anyone tell me whether the ANSI committee pondered over the problem of
tidying up the inconsistencies of the C initializations ?

		vic
--
Victor Gavin <vic at grep.co.uk||..!ukc!grep!vic||..!ukc!vision!grep!vic>



More information about the Comp.lang.c mailing list