Article View: borland.public.cppbuilder.nativeapi
Article #3760Re: What happens when ...
From: Helmut Giese
Date: Sat, 06 May 2006 15:24
Date: Sat, 06 May 2006 15:24
32 lines
1924 bytes
1924 bytes
Hi JD,
>I'm dealing with some old legacy code and have a couple of
>questions because I would never code it as it is.
Why not? To me it doesn't look bad.
>
>What's actually happening internally when a local variable is
>declared as such:
>
> char *ptr = "XXX";
The compiler puts the string "XXX" into a segment (which you should
consider non-writable) and puts the address of the string into 'ptr'.
>
>The other question is about structure that declares a member of
>it's own type within it's definition. For example:
It doesn't 'declare a member of its own type' - it declares, or rather
_defines_; a _pointer_ to its own type, which is perfectly ok, since
the compiler knows a pointer's size and can reserve the appropriate
space for it.
>
> struct TSomeStruct
> {
> ....
> TSomeStruct *x;
> TSomeStruct *y;
> };
>
>This compiles without warnings or errors but I would expect it
>not to because it looks to me like it's an incomplete data type
>when it hits x & y.
See above.
HTH
Helmut Giese
Technical Details
Message-ID:
<445cbe76.9704076@forums.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeder.wxs.nl!txtfeed2.tudelft.nl!tudelft.nl!txtfeed1.tudelft.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news.netcologne.de!nhp.netcologne.de!news.albasani.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailReferences:
<445cbd5d$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2f21d80b956d055f X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: hgiese@ratiosoft.com (Helmut Giese) Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: What happens when ... Date: Sat, 06 May 2006 15:24:04 GMT Message-ID: <445cbe76.9704076@forums.borland.com> References: <445cbd5d$1@newsgroups.borland.com> X-Newsreader: Forte Free Agent 1.11/32.235 NNTP-Posting-Host: 84.138.170.45 X-Trace: newsgroups.borland.com 1146930959 84.138.170.45 (6 May 2006 08:55:59 -0700) Lines: 33 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeder.wxs.nl!txtfeed2.tudelft.nl!tudelft.nl!txtfeed1.tudelft.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news.netcologne.de!nhp.netcologne.de!news.albasani.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail