[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#392880: gcc-4.1: off-by-one error for string initialiser warnings



Jochen Voss <voss@debian.org> writes:

> one very useful feature of gcc is, that it warns you when you
> produce unterminated strings by using too long initialisers.
> Unfortunately the warning only kicks in, if the initialiser is at
> least two bytes longer than the string buffer.

This is deliberate. In many situations, you do want to cut off the
zero bytes (e. g. char magic[4] = "DIVX"). After all, if you do not
want to restrict the length, why are you giving a number at all?

-- 
	Falk



Reply to: