You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Gordon Sim (JIRA)" <ji...@apache.org> on 2011/04/13 12:50:05 UTC

[jira] [Commented] (QPID-3206) Variant converts from negative number in string format to unsigned integer without error

    [ https://issues.apache.org/jira/browse/QPID-3206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019276#comment-13019276 ] 

Gordon Sim commented on QPID-3206:
----------------------------------

Suggested change to retain behaviour of older gcc: https://reviews.apache.org/r/596/

> Variant converts from negative number in string format to unsigned integer without error
> ----------------------------------------------------------------------------------------
>
>                 Key: QPID-3206
>                 URL: https://issues.apache.org/jira/browse/QPID-3206
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Broker, C++ Client
>    Affects Versions: 0.8, 0.10
>            Reporter: Gordon Sim
>            Assignee: Gordon Sim
>             Fix For: 0.11
>
>
> E.g. 
>   uint16_t i = 0;
>   qpid::types::Variant v = "-5";
>   i = v;
> The above results in an exception in older versions of gcc (e.g. 4.1.2) but sets i to 65531 on later versions (e.g. 4.4.4). This is a result of a fix to the gcc std library to be compliant with specification which requires stringstream to accept negative values even for unsigned ints (which is the behaviour of scanf).
> See e.g:
> http://boost.2283326.n4.nabble.com/conversion-lexical-cast-doesn-t-throw-td2593967.html
> http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/97475b21515462c9/ce369a327fa39243#ce369a327fa39243

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org