[Insight-developers] atoll and strtoll issues for VC express

Alexandre GOUAILLARD agouaillard at gmail.com
Wed Oct 27 20:25:23 EDT 2010


to single out MSVC there is
_MSV_VER

http://msdn.microsoft.com/en-us/library/b0084kay.aspx

alex.


On Thu, Oct 28, 2010 at 8:06 AM, wanlin <wanlinzhu at gmail.com> wrote:
> Hi Luis,
>
> Many thanks, I will do it as you suggest.
>
>
>
>
>
> best wishes
>
> wanlin
>
> On Thu, Oct 28, 2010 at 6:29 AM, Luis Ibanez <luis.ibanez at kitware.com>
> wrote:
>>
>> Hi Wanlin,
>>
>> I haven't been able to find a clear answer about the
>> use of "atoll" on Windows.
>>
>> So,
>> using using #ifdef seems to be a reasonable first approach.
>>
>> Just be weary that WIN32 is not only defined in Visual Studio,
>> but also in Cygwin and MinGW, so the set of #ifdef may be a
>> bit more complex.
>>
>>
>> See for example, line 524 of
>>
>>                   ITK/Code/Common/itkMacro.h
>>
>>  #if defined( _WIN32 ) && !defined( __MINGW32__ ) && !defined( __CYGWIN__
>> )
>>
>>
>>
>>      Luis
>>
>>
>> -------------------------------------------------------------------------
>> On Tue, Oct 26, 2010 at 10:14 PM, wanlin <wanlinzhu at gmail.com> wrote:
>>>
>>> Hi, all
>>>       When adding Gifti IO support to itkMeshIO, I encountered the errors
>>> that atoll and strtoll not defined for MS visual studio c++ compiler
>>> (express 2008). Currently i am trying to solve it like this
>>> #ifdef WIN32
>>>         DA->ext_offset = atol(value);
>>> #else
>>>         DA->ext_offset = atoll(value);
>>> #endif
>>>
>>>
>>> #ifdef WIN32
>>>                 llval = strtol(p1, &p2, 10);
>>> #else
>>>                 llval = strtoll(p1, &p2, 10);
>>> #endif
>>>
>>> Which make the tests past. I am wondering Is it acceptable or is there a
>>> better and safe replacement to make it work under MS compilers?
>>>
>>>
>>>
>>
>
>


More information about the Insight-developers mailing list