Re: [Dev-C++] Demystifying namespace
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <ce...@te...> - 2003-12-18 22:23:44
|
Yeah, I understand that perfectly.
I understood the last maya's question as "passing them (__func__ and
__line__) to a srting!!!??? What you say passes the value, I wanted to
pass the variable name*". The answer, is that her code, was intending to
do just that an std:string variable to which a __func__ or __liner__
were to be passed..
It was like her was thinking that when passing the #defined name for
them the item passed to her string variables where something like the
name of the "definition" variable, which has no sense. Hum, in that
moment I saw that sense of her question clearly, know, I wonder if I
really understood her question.
And yes, the errors should appear there, but I've noticed mingw has some
tendency to point the errors related to #defined thing in the next
lines; and thos related to missing ';' in headers to the begining of the
source file which includes the header.
Thanks.
P.S. - The high cross-posting comes from her message, I simply clicked
'reply all'
*which translated to code, say
__line__ = "this is the line blah" (sorry if this has no sense, but I'd
never used this);
She thinks,
if #define foo __line__
std::string yuu = foo; ----> yuu = "__line__" (which makes no sense)
instead of "this is the line blah".
Lars Hallberg wrote:
> Carlos García del Monte wrote:
>
>> For what I see, your code is doing exactly the same, but without
>> using those #defines
>
>
>
> The strange thing is that You get the error in the std::cout. You
> suposed tho get them erlier.
>
> #define declare preprosessor constant ('dumb' text string constants)
> that is global, they shuld not care about scope. They are replaced
> litary as text. Your code:
>
> std::string f = foo::file;
> size_t l = foo::line;
>
> Transforme to:
>
> std::string f = foo::__func__;
> size_t l = foo::__LINE__;
>
> or rather, the value of thes 'special' constants at the #define. The
> compile shuld likely find errors there :-/
>
> Maya:s code actuly declare thes constants as 'real' constants in the
> scoop foo, shuld make all the differens!
>
> PS Litle *too* much crosposting this, is it not? DS
>
> HTH /LaH
>
>>
>> Maya wrote:
>>
>>> I want to replace the word __func__ with the word file, and you are
>>> telling me to assign the value of __func__ to the std::string variable?
>>
>
|