help-gengetopt
[Top][All Lists]
Advanced

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

Re: [help-gengetopt] longlong not working


From: Lorenzo Bettini
Subject: Re: [help-gengetopt] longlong not working
Date: Mon, 03 Sep 2012 15:21:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0

Simon

could you please file a bug report here?

http://savannah.gnu.org/bugs/?group=gengetopt

thanks in advance
        Lorenzo

On 09/03/2012 03:06 PM, Simon Josefsson wrote:
Hi.  In OATH Toolkit I started to use the 'longlong' feature recently,
to be able to specify 64-bit integers.  However I noticed that it
doesn't really work well.  There are two reasons for this:

1) The generated code use the HAVE_LONG_LONG pre-processor symbol to
check whether 'long long' is available.  I didn't have that symbol
defined, I did have HAVE_LONG_LONG_INT defined via gnulib.  This issue
could be resolved with improved documentation, stating that you need to
make sure HAVE_LONG_LONG is defined when building.

2) The generated code uses 'strtol' to convert values.  This function
does not handle larger values.  The code looks like this:

#ifdef HAVE_LONG_LONG
     if (val) *((long long int*)field) = (long long int) strtol (val,
&stop_char, 0);
#else
     if (val) *((long *)field) = (long)strtol (val, &stop_char, 0);
#endif

Changing 'strtol' to 'strtoll' works.  I'm guessing platforms with 'long
long' have 'strtoll' as well, but I can't guarantee it.

/Simon

_______________________________________________
Help-gengetopt mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-gengetopt



--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]