[xsd-users] gcc warning

Rizzuto, Raymond Raymond.Rizzuto at sig.com
Mon Oct 27 16:00:12 EDT 2008


Boris,

I'm glad to hear that the warning isn't caused by anything I am doing wrong.

Unfortunately, I can't move to a new version of gcc till I move to sles 10, which I can't do yet because of other dependencies.

I am using the (int &) work-around for now.  That works, so I'll use that for now.

Thanks again for all the help.

Ray

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: Monday, October 27, 2008 10:05 AM
To: Rizzuto, Raymond
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] gcc warning

Hi Ray,

Rizzuto, Raymond <Raymond.Rizzuto at sig.com> writes:

> In one place in my code, I want to get the id out of a constructed object,
> and pass it to a function taking int.   I.e. essentially do this
>
>    functionTakingAnInt(stock.get_id());
>
> When I compile the code (gcc 3.3.3), I get this warning:
>
> [...]
>
> Is there a better method that prevents this warning?

This is a well-known, bogus warning in older versions of g++.
Unfortunately I don't have access to the version that produces
this warning so I couldn't test my work-arounds (g++ 3.3.6 as
well as 3.2.3 that I have access to don't have this bug).

I think the following should work (besides upgrading the compiler,
of course):

functionTakingAnInt((int&)stock.get_id ());

const ReferenceDataId& id (stock.get_id ());
functionTakingAnInt(id);

Making stock const should also help. If you don't plan to modify
stock then this might be the cleanest approach.

Boris




IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.




More information about the xsd-users mailing list