 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Alex Vinokur Guest
|
Posted: Tue Sep 12, 2006 9:10 am Post subject: const char* as a static member |
|
|
Is this library safe?
Does this have to do with Position Independent Code?
====== Library ======
--- File foo.h ---
struct Foo
{
static const char* s_name;
// Stuff
};
-------------------
--- File foo.cpp ---
const char* Foo::s_name = "ABCD";
// Stuff
-------------------
====================
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn |
|
| Back to top |
|
 |
Ivan Vecerina Guest
|
Posted: Tue Sep 12, 2006 9:10 am Post subject: Re: const char* as a static member |
|
|
"Alex Vinokur" <alexvn (AT) users (DOT) sourceforge.net> wrote in message
news:1158042703.368926.259390 (AT) p79g2000cwp (DOT) googlegroups.com...
: Is this library safe?
The posted code is perfectly safe according to the C++
standard.
: ====== Library ======
:
: --- File foo.h ---
:
: struct Foo
: {
: static const char* s_name;
: // Stuff
: };
:
: -------------------
:
: --- File foo.cpp ---
:
: const char* Foo::s_name = "ABCD";
:
: // Stuff
:
: -------------------
:
: ====================
: Does this have to do with Position Independent Code?
Position Independent Code does not "exist" in C++.
As I understand it, PIC is an implementation detail of
generated code on some platforms, where only PC-relative
addresses are used to allow the code to be relocated
in memory without requiring any absolute address fixing.
I don't see that the above code illustrates anything
specifically related to PIC.
http://en.wikipedia.org/wiki/Position_independent_code
Cheers --Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <> http://www.brainbench.com |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|