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

Luis Ibanez luis.ibanez at kitware.com
Wed Oct 27 16:29:49 EDT 2010


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?
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101027/d642e234/attachment.htm>


More information about the Insight-developers mailing list