On 05/25/2012 05:27 PM, Jason Merrill wrote:

> On 05/25/2012 08:46 AM, Dominique Dhumieres wrote:
>> I certainly prefer this alternative (the use of extern for that purpose
>> being extremely confusing for a fortraner;-). However, if my test is valid,
>> if N is not equal to 2 or 4, one gets the following error
>>
>> error: size of array 'l' is negative
>>
>> Would not it be better to have an explicit test of N being 2 or 4, and an 
>> error
>> of the kind "the vector size has to be the size of 2 or 4 long" if not?
> 
> There's no way to tell the compiler to emit that kind of error (in C; that's 
> what C++11 static_assert is for).


You can simply rename the 'l' array to the error you want to output, so you get 
an error like:

error: size of array 'the_vector_size_has_to_be_the_size_of_2_or_4_long' is 
negative

or whatever you want to say as error.

-- 
Pedro Alves

Reply via email to