help-gplusplus
[Top][All Lists]
Advanced

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

Re: cannot pass objects of non-POD type


From: Vijay Patil
Subject: Re: cannot pass objects of non-POD type
Date: Wed, 13 Oct 2004 05:08:10 -0700 (PDT)

--- John Harrison <john_andronicus@hotmail.com> wrote:

> 
> "Vijay" <vijaypatil78@yahoo.com> wrote in message
>
a684298b.0410130336.48eef0e2@posting.google.com">news:a684298b.0410130336.48eef0e2@posting.google.com...
> > Hi all,
> >     Im using
> > gcc version 3.2.3 20030502 (Red Hat Linux
> 3.2.3-20)
> > on 64bit linux server
> >
> > im trying to compile following code
> > --------------------sam.cpp---------------------
> > #include <string>
> > #include <iostream>
> > #include <stdarg.h>
> > using namespace std;
> >
> > void Write( const char* msg, const char* msg2,
> ...)
> > {
> >     cout <<msg <<" "<<msg2<<endl;
> > }
> >
> > int main()
> > {
> >     string str("World");
> >     Write("Hello","Debug out %s"  ,str);
> 
> No idea what you are trying to do, why pass str to
> Write when you don't use
> str inside Write? Anyway try this
> 
> Write("Hello", "Debug out %s", str.c_str());
> 
> C strings and C++ strings are not the same.
> 
Actualy i kow this will solve the problem, I have very
larg project, which used TRACE macro, which takes
variable number of arguments. this TRACE intern calls
Write method which log into file.

Also to note that im porting this project from gcc2.95
to gcc3.2.3

All the binaries work file with gcc 2.95 but all the
binaries compiled with gcc3.2.3 fail with illegal
instruction.

every where code is somethig like this
----------------------------
String fDatafile;
TRACE("data", "Datafile is %s", fDatafile);
------------------------------

all the binaries when it calls TRACE macro

i hope u got my problem.

> john
> 
> 
> _______________________________________________
> Help-gplusplus mailing list
> Help-gplusplus@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gplusplus
> 


=====
Thanks and Regards
Vijay


                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com




reply via email to

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