C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

const char* as a static member

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Alex Vinokur
Guest





PostPosted: Tue Sep 12, 2006 9:10 am    Post subject: const char* as a static member Reply with quote



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





PostPosted: Tue Sep 12, 2006 9:10 am    Post subject: Re: const char* as a static member Reply with quote



"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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.