Just noticed this conversation
From: [email protected] [mailto:[email protected]] On Behalf Of haquin
> Le 06/06/2012 18:23, Andrew Johnson a écrit :
> > On 2012-06-06 Dirk Zimoch wrote:
> >> I had assumed that the primary application for hex numbers would be bit
> >> masks. Signed masks do not make much sense but 0x80000000 does make
> >> sense. Maybe we should test for minus and then either call strtol() or
> >> strtoul().
> > Agreed, I will do that (currently writing lots of tests...).
I'm pretty sure it's always safe to strtoul(), the behaviour in the presence of a minus sign seems well defined in the man page I'm reading and I've certainly not encountered problems using it.
It's safer to use strtoul() rather than strtol() in general if you want modulo word size behaviour (which us low level engineers tend to), as I've encountered very unfriendly overflow behaviour from strtol(). Alas even strtoul() checks for overflow on negation :(
- Replies:
- Re: mask for bitwise operation in CALC record Andrew Johnson
- References:
- mask for bitwise operation in CALC record haquin
- Re: mask for bitwise operation in CALC record Eric Norum
- Re: mask for bitwise operation in CALC record Dirk Zimoch
- Re: mask for bitwise operation in CALC record Andrew Johnson
- Re: mask for bitwise operation in CALC record haquin
- Navigate by Date:
- Prev:
FW: caQtDM Mezger Anton Christian
- Next:
RE: Consequences of the leap-second michael.abbott
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: mask for bitwise operation in CALC record haquin
- Next:
Re: mask for bitwise operation in CALC record Andrew Johnson
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|