[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lily/freetype-error.cc: const struct #include ;
From: |
Werner LEMBERG |
Subject: |
Re: lily/freetype-error.cc: const struct #include ; |
Date: |
Mon, 06 Sep 2010 21:08:05 +0200 (CEST) |
[Wearing the FreeType maintainer hat]
>> I see a really weird C++ construct in this (short) file:
What's the problem?
>> lily/freetype-error.cc
>>
>> --------
>> const struct Freetype_error_message
>> {
>> FT_Error err_code;
>> const char* err_msg;
>> } ft_errors[] =
>>
>> #include <freetype/fterrors.h>
>>
>> ;
>> --------
>>
>> The #include and the ; appear to be part of the const struct --
>> moving the #include further up in the file produces a compile
>> error.
>>
>> Does anybody know what this is doing,
It assigns info strings to error codes.
>> and more importantly, how it could be written in more
>> standard/typical C++ ?
Why? After macro expansion, you get a simple structure. And no, this
can't be written differently if you want to retain the flexibility
given in the FreeType code. We regularly test with C++ compilers
(well, mainly with g++), and this construction has never caused
problems.
Werner