Run Microsoft Analyzer over dmd source code

KennyTM~ kennytm at gmail.com
Sun Aug 7 12:19:22 PDT 2011


On Aug 8, 11 03:08, KennyTM~ wrote:
> On Aug 8, 11 02:45, bearophile wrote:
>> Vladimir Panteleev:
>>
>>> http://thecybershadow.net/d/vcanalysis/
>>
>> As with (first report of) Clang I see that assert(p); p->foo... are
>> marked as "Dereferencing NULL pointer".
>>
>>
>> Do you know the purpose of this?
>> os->name = strdup(name);
>> warning C4996: 'strdup': The POSIX name for this item is deprecated.
>> Instead, use the ISO C++ conformant name: _strdup. See online help for
>> details. c:\Program Files (x86)\Microsoft Visual Studio
>> 10.0\VC\include\string.h(238) : see declaration of 'strdup'
>>
>
> http://stackoverflow.com/questions/14386/fopen-deprecated-warning
>

Oops sorry that link is for those silly _s versions. _strdup is actually 
worse, it's only because Microsoft has chosen to add a '_' to all POSIX 
functions with no good reason (maybe just §17.6.4.3.2=[global.names]/1).

http://msdn.microsoft.com/en-us/library/y471khhc%28v=VS.100%29.aspx

I recommend ignoring all C4996 since the DMD source code shouldn't just 
accommodate for MSVC.

>>
>> And do you know what kind of troubles this warning helps to avoid?
>> c:\projects\extern\d\dmd\src\root\dchar.h(164): warning C6328: 'char'
>> passed as parameter '1' when 'unsigned char' is required in call to
>> 'isalpha'
>>
>
> You could search the error code in Google to get the info in MSDN.
>
> http://msdn.microsoft.com/en-us/library/ms245348%28v=VS.100%29.aspx:
>
> "For routines starting with is*, passing an argument of type char might
> yield unpredictable results. For example, an SBCS or MBCS single-byte
> character of type char with a value greater than 0x7F is negative. If a
> char is passed, the compiler might convert the value to a signed int or
> a signed long. This value could be sign-extended by the compiler, with
> unexpected results."
>
>> Bye,
>> bearophile
>



More information about the Digitalmars-d mailing list