Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Question on structures Message-ID: <9308@mimsy.UUCP> Date: Wed, 11-Nov-87 20:04:21 EST Article-I.D.: mimsy.9308 Posted: Wed Nov 11 20:04:21 1987 Date-Received: Sat, 14-Nov-87 06:00:04 EST References: <1025@phoenix.Princeton.EDU> <3022@bunker.UUCP> <150@fxgrp.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 42 Keywords: Sturctures records [Aside to ljz: you are misusing the `Followup-To' header. It is supposed to redirect followup messages to another newsgroup, not indicate the article to which this message is a followup. *That* funciton belongs to the `References' line, which is maintained automatically by current netnews software (including yours).] In article <150@fxgrp.UUCP> ljz@fxgrp.UUCP (Lloyd Zusman) writes: >#define WITH(Name, Type, Struct) { Type *Name = &(Struct); >#define ENDWITH } ... > WITH (X, struct baz, p.z.i) > X->a = 1; > X->b = 2; > X->c = 3; > ENDWITH The problem with such macros is that they rapidly get out of hand. Perhaps no one will sue me for posting the following extract: readsym() { REG char *p; p = isymbol; REP IF p < &isymbol[sizeof(isymbol)-1] THEN *p++ = lastc; FI readchar(); PER symchar(1) DONE *p++ = 0; } symchar(dig) { IF lastc=='\\' THEN readchar(); return(TRUE); FI return( isalpha(lastc) ORF lastc=='_' ORF dig ANDF isdigit(lastc) ); } (Yes, the above *is* C code.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris