[syslinux] [PATCH 3/5] installers: MSVC compatibility fixes

Shao Miller sha0.miller at gmail.com
Mon Mar 7 09:29:26 PST 2016


On 3/7/2016 09:01, Pete Batard via Syslinux wrote:
> On 2016.03.07 01:21, Shao Miller via Syslinux wrote:
>> 3. Disable the Microsoft precision warning, since Syslinux does lots of
>> this sort of thing.
>>
>> That last option seems pretty simple, without moving entirely from /W3
>> to /W2.  Could that work?  (C4242)
>
> Unfortunately, there are some warnings that Microsoft, in their great 
> wisdom, decided that driver developers should not choose to ignore, 
> and this is one of them...
>
> /wd4242 (which is how you disable warnings in WDK), is one of the 
> things I tried before going /W2, only to find that, unlike other 
> warnings, which I double-checked you can actually silence with /wd 
> (for instance /wd4018 --signed/unsigned mismatch-- can be disabled 
> alright), this one could not be silenced.

Oh, that's not great.

Well perhaps some nearby code to describe the purpose of the cast and to 
ensure that it's safe, along the lines of:

https://books.google.ca/books?id=6ipFVfxKeN0C&pg=PT257&lpg=PT257&ots=NIFw5TgKey&sig=r7axj5hT28q2TgGbCJpHntcwm84&hl=en&sa=X&ved=0ahUKEwiIx6DHia_LAhWikIMKHeWWAV8Q6AEIOjAF

(Mind you, that book is wrong about at least one thing:

> NOTE: While unsigned types can usually represent all positive values 
> of the
> corresponding signed type, this relationship is not guaranteed by the C99
> standard.

Which is wrong.  C99 reads, at 6.2.5p9:

> The range of nonnegative values of a signed integer type is a subrange 
> of the
> corresponding unsigned integer type, and the representation of the 
> same value in each
> type is the same.

Anyway, this isn't Usenet's comp.lang.c nor comp.std.c...)

Thank goodness this is in the installer code, where such extra checks 
isn't particularly expensive.

--
- Shao Miller
synthetel.com://https


More information about the Syslinux mailing list