Ian Collins
5/12/2011 11:34:00 PM
On 05/13/11 11:30 AM, Fred the Freshwater Catfish wrote:
> On Fri, May 13, 2011 at 11:20:30AM +1200, Ian Collins wrote:
>> On 05/13/11 11:17 AM, Fred the Freshwater Catfish wrote:
>>> On Fri, May 13, 2011 at 11:07:09AM +1200, Ian Collins wrote:
>>>> On 05/13/11 10:59 AM, Fred the Freshwater Catfish wrote:
>>>>> Hey guys,
>>>>>
>>>>> I've been writing some code that I would prefer to be maximally
>>>>> portable. As I have mostly used Linux, gcc is pretty much the only C
>>>>> compiler I've ever used under UN*X. I'd like to use non-constant
>>>>> initializers for some global variables. I'm pretty sure I can get it
>>>>> to work the way I want under gcc, but what of other compilers? The
>>>>> gcc documentation in info format says that ISO C99 allows this, and so
>>>>> I expect some compilers built in the 90's will support the feature,
>>>>> but to what extent is this true?
>>>>
>>>> How do you derive the initialiser values?
>>>
>>> It should end up being a function call most of the time.
>>
>> Then you either want C++, or a singleton fiddle as posted else-thread.
>
> Sorry, I'm not using C++.
But you require a C++ feature...
You could compile all but main() as C and compile the source file
containing main() and your initialisers as C++.
--
Ian Collins