msg00670.html
1999Q1/msg00670.html · 7.4 KB
From the archive 1999Q1.zip
Download the archive « Back to the archive contents
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories) -->
<!--X-From-R13: Ayn Tbfurvz =?vfb-8859-1?C?Ue=T8fgnq?= <byntNvsv.hvb.ab> -->
<!--X-Date: Mon, 22 Mar 1999 05:18:40 -0800 -->
<!--X-Message-Id: 36F6B03C.4A95723D#ifi,uio.no -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199903221656.IAA17911#cashew,snugharbor.com.snugharbor.com -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Re: Variable-sized structures in C (was: Naming </title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:olag#ifi,uio.no">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">
<font size="+4" color="#804040">
<strong><em>MUD-Dev<br>mailing list archive</em></strong>
</font>
<br>
[ <a href="../">Other Periods</a>
| <a href="../../">Other mailing lists</a>
| <a href="/search.php3">Search</a>
]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->
Date:
[ <a href="msg00669.html">Previous</a>
| <a href="msg00671.html">Next</a>
]
Thread:
[ <a href="msg00668.html">Previous</a>
| <a href="msg00671.html">Next</a>
]
Index:
[ <A HREF="author.html#00670">Author</A>
| <A HREF="#00670">Date</A>
| <A HREF="thread.html#00670">Thread</A>
]
<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</LI>
<LI><em>From</em>: Ola Fosheim Grøstad <<A HREF="mailto:olag#ifi,uio.no">olag#ifi,uio.no</A>></LI>
<LI><em>Date</em>: Mon, 22 Mar 1999 22:03:56 +0100</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Sender</em>: <A HREF="mailto:mud-dev-admin#kanga,nu">mud-dev-admin#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
"T. Alexander Popiel" wrote:
> As suspected, this is not fully portable. (It also won't compile
> due to redeclaration of n, but that's minor.)
None of my code (on this list) will compile :-). People should write
their own code.
> The "proper" way
> to do it is:
>
> struct node {
> object *obj;
> node *l,*r;
> const char key[MAX_KEY_BUFFER_SIZE];
> };
[...]
> This approach eliminates nasty pointer math, prevents problems
> caused by allocating larger than the struct definition (which
> can blow up on segmented architectures)
Really?? Good to know. That's a good reason to do as you say.
Unfortunately you now risk getting some extra padding bytes which the
C-compiler adds to the size of struct node in order to make it aligned in
arrays, which was what I tried to generally avoid in the first place! :-/
However, it is probably worth it for the above mentioned reasons. (and
can be avoided if you know your target)
--
Ola Fosheim Groestad,Norway <A HREF="http://www.stud.ifi.uio.no/~olag/">http://www.stud.ifi.uio.no/~olag/</A>
_______________________________________________
MUD-Dev maillist - MUD-Dev#kanga,nu
<A HREF="http://www.kanga.nu/lists/listinfo/mud-dev">http://www.kanga.nu/lists/listinfo/mud-dev</A>
</PRE>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00668" HREF="msg00668.html">[MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</A></STRONG>
<UL><LI><EM>From:</EM> "T. Alexander Popiel" <popiel#snugharbor,com></LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00669.html">RE: [MUD-Dev] Self-organizing worlds (was: Elder Games)</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00671.html">[MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00668.html">[MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00671.html">[MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00670"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00670"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>RE: [MUD-Dev] Self-organizing worlds (was: Elder Games)</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00689" HREF="msg00689.html">RE: [MUD-Dev] Self-organizing worlds (was: Elder Games)</A></strong>,
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Wed 24 Mar 1999, 02:42 GMT
<UL>
<LI><strong><A NAME="00696" HREF="msg00696.html">Re: [MUD-Dev] Self-organizing worlds (was: Elder Games)</A></strong>,
Mik Clarke <a href="mailto:mikclrk#ibm,net">mikclrk#ibm,net</a>, Thu 25 Mar 1999, 00:19 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00695" HREF="msg00695.html">Re: [MUD-Dev] Self-organizing worlds (was: Elder Games)</A></strong>,
Benjamin D. Wiechel <a href="mailto:strycher#toast,net">strycher#toast,net</a>, Wed 24 Mar 1999, 21:39 GMT
</LI>
</ul>
</LI>
<LI><strong><A NAME="00668" HREF="msg00668.html">[MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</A></strong>,
T. Alexander Popiel <a href="mailto:popiel#snugharbor,com">popiel#snugharbor,com</a>, Mon 22 Mar 1999, 10:28 GMT
<UL>
<LI><strong><A NAME="00670" HREF="msg00670.html">Re: [MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</A></strong>,
Ola Fosheim Grøstad <a href="mailto:olag#ifi,uio.no">olag#ifi,uio.no</a>, Mon 22 Mar 1999, 13:18 GMT
</LI>
<LI><strong><A NAME="00671" HREF="msg00671.html">[MUD-Dev] Re: Variable-sized structures in C (was: Naming and Directories)</A></strong>,
Petri Virkkula <a href="mailto:pvirkkul#iki,fi">pvirkkul#iki,fi</a>, Mon 22 Mar 1999, 13:39 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00635" HREF="msg00635.html">[MUD-Dev] Unicode, ascii and names</A></strong>,
Ola Fosheim Grøstad <a href="mailto:olag#ifi,uio.no">olag#ifi,uio.no</a>, Wed 17 Mar 1999, 13:25 GMT
<LI><strong><A NAME="00614" HREF="msg00614.html">[MUD-Dev] Mass Creation OLC Functions (idea from Elder Games)</A></strong>,
Wes Connell <a href="mailto:wconnell#adhesive,com">wconnell#adhesive,com</a>, Tue 16 Mar 1999, 14:46 GMT
<UL>
<LI><strong><A NAME="00618" HREF="msg00618.html">Re: [MUD-Dev] Mass Creation OLC Functions (idea from Elder Games)</A></strong>,
Matthew Mihaly <a href="mailto:diablo#best,com">diablo#best,com</a>, Tue 16 Mar 1999, 21:00 GMT
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>
</ul>
<hr>
<center>
[ <a href="../">Other Periods</a>
| <a href="../../">Other mailing lists</a>
| <a href="/search.php3">Search</a>
]
</center>
<hr>
</body>
</html>