Hello,
I am getting complation warning saying,
warning : returning reference to temporary.
The code from which it is coming:
vector<boola_oObj;
This vector is filled with all boolean values
Then when I want to check a condition on this
for loop
int i = 0;
if(obj[i] == true) //warning comes here
Thanks in Advance,
Subrat 5 1540
Subrat wrote:
Hello,
I am getting complation warning saying,
warning : returning reference to temporary.
The code from which it is coming:
vector<boola_oObj;
This vector is filled with all boolean values
Then when I want to check a condition on this
for loop
int i = 0;
if(obj[i] == true) //warning comes here
Thanks in Advance,
Subrat
Your example doesn't compile and I do not see a return statement,
therefore can't say anything.
Next function would produce that warning:
bool& f()
{
bool a = true;
return a;
}
The example is not a perfect piece of code. Thats an abstract code
"anon" <an**@no.nowrote in message news:g6**********@news01.versatel.de...
Subrat wrote:
Hello,
I am getting complation warning saying,
warning : returning reference to temporary.
The code from which it is coming:
vector<boola_oObj;
This vector is filled with all boolean values
Then when I want to check a condition on this
for loop
int i = 0;
if(obj[i] == true) //warning comes here
Thanks in Advance,
Subrat
Your example doesn't compile and I do not see a return statement,
therefore can't say anything.
Next function would produce that warning:
bool& f()
{
bool a = true;
return a;
}
On Jul 25, 3:38 pm, "Subrat" <subrat.sah...@in.bosch.comwrote:
"anon" <a...@no.nowrote in messagenews:g6**********@news01.versatel.de...
Subrat wrote:
Hello,
I am getting complation warning saying,
warning : returning reference to temporary.
The code from which it is coming:
vector<boola_oObj;
This vector is filled with all boolean values
Then when I want to check a condition on this
for loop
int i = 0;
if(obj[i] == true) //warning comes here
Thanks in Advance,
Subrat
Your example doesn't compile and I do not see a return statement,
therefore can't say anything.
The example is not a perfect piece of code. Thats an abstract code
It's not sufficient to explain the compiler warning. I suggest you
post your actual code.
Tony
"Subrat" <su***********@in.bosch.comwrites:
Hello,
I am getting complation warning saying,
warning : returning reference to temporary.
The code from which it is coming:
vector<boola_oObj;
This vector is filled with all boolean values
Then when I want to check a condition on this
for loop
int i = 0;
if(obj[i] == true) //warning comes here
Other have mentionned that this is no compilable code. But in any
case, you show us a variable named a_oObj, and then you refer a
variable named obj.
--
__Pascal Bourguignon__
On Jul 25, 3:11*pm, "Subrat" <subrat.sah...@in.bosch.comwrote:
Hello,
I am getting complation warning saying,
warning : returning reference to temporary.
The code from which it is coming:
vector<boola_oObj;
This vector is filled with all boolean values
Then when I want to check a condition on this
for loop
int i = 0;
if(obj[i] == true) //warning comes here
Thanks in Advance,
Subrat
Please post the code of the function in which you get the warning.
You must be doing what anon said, which is,
vector<bool>& myFunc() // note the "&", if you remove that, its a
quick-fix that will work, although its one damn slow copy-constructor
{
...
vector<boolv;
return v; // warning; accessing the returned value should either
crash or read garbage
}
Cheers!
-- raicuandi This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ced |
last post by:
Hi,
i'm not an expert in C but i try to compile BTNG software under linux
kernel 2.4.2-2. I get these errors at the very first stage. Does
someone could have a rapid look on this and tell me...
|
by: Rick Anderson |
last post by:
All,
I am receiving the following compilation error on LINUX
(but not Solaris, HPUX, WIN32, etc):
compiling osr.c
LBFO.h(369): warning #64: declaration does not declare anything
extern...
|
by: ChrisB |
last post by:
Hello:
I notice that the following statements generate a "the variable 'e' is
declared but never used" warning:
try
{
Company.Fetch(CompanyID);
}
catch(RecordNotFoundException e)
|
by: Dan |
last post by:
Hi,
I have a problem using an aspx page with a Control on it. I get the
following error message
Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple
places; using definition...
|
by: alban |
last post by:
Hello
I have got some problems of compilation on a AIX IBM,
I use the XLC compilator (And I can't install another one).
I try to compile code Pro*c ".pc" (oracle), I need do a pre-compilation...
|
by: subramanian |
last post by:
Consider the following program:
#include <stdio.h>
void myfn(const int **a)
{
static int i, j, k;
a = &i;
a = &j;
|
by: hamardk |
last post by:
Hi,
I'm trying to compile log4cpp-0.3.5rc3
on :
SunOS belaurora 5.9 Generic_118558-11 sun4u sparc SUNW,Ultra-4
I'm having compilation issues which are:
In file included from...
|
by: antoine |
last post by:
Hi all! I'm a French student currently doing an internship in Beijing. I have to simulate a mips machine running with the micro kernel l4. When i compile the kernel i got some compilation errors. I...
|
by: Richard Weeks |
last post by:
My question, stated as simply as possible, is: must a constraint
violation, as defined by the standard, cause compilation to halt?
I believe that in the presence of a constraint violation, at...
|
by: |
last post by:
Hi,
After installing SP1 for VS2008 and SP1 for .NET 3.5 we get the following
warning in a VS2005 build:
error CS0618: Warning as Error: 'System.Windows.UIElement.BitmapEffect' is
obsolete:...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |