🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16979

Re: odd question...how to know variable name

#16979
From: Ron Sommer
Date: Sat, 12 Apr 2003 10:05
17 lines
1952 bytes
> Is there a way for my constructor, or any class function to "know" that the
> instance name is "AAA"? I want o use it for named shared memory.


Variables have a very small scope compared to shared memory segments. 
Therefore, it wouldn't be a good idea to name shared memory segments 
after variable names: Better try to use unique names, created from a 
unique property of the variable to use, e.g. memory location, or a 
global counter.

However, you can enhance classes so that they register automatically 
with a list or container at creation. You'd of course have to hand over 
the name of the variable in an extra string, so that it can be stored in 
this list. In general, I really don't recommend that, but, of course, I 
don't know what you need that for.

Ron Sommer
Technical Details
Message-ID: <3E97E4D8.3060503@telekom.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!216.65.3.53.MISMATCH!news-out.spamkiller.net!propagator2-maxim!propagator-maxim!feed.newsfeeds.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3e95d8a6$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,289eae8b8f86e355
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-12 03:50:59 PST
Message-ID: <3E97E4D8.3060503@telekom.de>
Date: Sat, 12 Apr 2003 12:05:12 +0200
From: Ron Sommer <summertime@telekom.de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-DE; rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3
X-Accept-Language: de-DE
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: odd question...how to know variable name
References: <3e95d8a6$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 217.81.124.248
X-Trace: newsgroups.borland.com 1050141900 217.81.124.248 (12 Apr 2003 03:05:00 -0700)
Lines: 18
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!216.65.3.53.MISMATCH!news-out.spamkiller.net!propagator2-maxim!propagator-maxim!feed.newsfeeds.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail