From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of David Empson

>>>The ANSI/ISO C 1990 standard states this in section 6.5.7, under Constraints:
>>>“All the expressions in an initializer for an object that has static storage 
>>>duration or in an initializer list for an object that has aggregate or union 
>>>type shall be constant expressions.”

>>>In this case the code is trying to initialize a field of an auto struct 
>>>using the db parameter passed to the function. That is not a constant 
>>>expression, and it is in an initializer list for an object that has 
>>>aggregate type (whether or not the object has static storage duration), so 
>>>is disallowed under ANSI/ISO C 1990.

>>>Later versions of the C standard removed the bit about aggregate or union 
>>>types, leaving only the static restriction, e.g. from section 6.7.8 of the 
>>>draft C99 standard:
>>>"All the expressions in an initializer for an object that has static storage 
>>>duration shall be constant expressions or string literals.”

I can confirm that. So in summary, the Sqlite code is not valid ANSI C (1990) 
but it is valid according to the C99 standard. It's only broken for old 
compilers, not new ones.

1. Why was VS the first compiler to detect this?
2. Is there an authoritative view on which standard Sqlite should comply with?

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org





_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to