🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9678

Re: Block Initialization

#9678
From: Tom Stockfisch
Date: Thu, 30 Oct 1986 05:27
42 lines
1757 bytes
[ ">>" and "" is me (Tom Stockfisch), and ">" is Chris Torek ]

>>The obvious solution is to make assignment of zero to any structure a
>>defined operation guaranteed to get the appropriate bit patterns into
>>all the pointer elements. ...
>>
>>		struct big_sucker	var;
>>
>>		var =	0;	/* (no comment needed) */

>I dislike this: it is Yet Another Special Case.

I see this as *eliminating* a special case, since we already have

	double		x =	0;
	int		i =	0;
	long		j =	0;
	char		*p =	0;
	char		c =	0;
	struct foo	*bar =	0;

and (as a special case)
	
	struct foo	elt =	0;

is disallowed.  All this extension does (I think) is add one more conversion
rule, specifying how "0" gets widened to a "struct foo".
So what would be the harm?

>...I think the proper
>obvious solution is to allow aggregate structure constants:
>
>		var = { 0 };

Of course I would like this feature to be added as well, especially when I
have to deal with complex numbers.  If I had to choose, I would take
	
	var =	{ 0 };

since it is more powerful.

-- Tom Stockfisch, UCSD Chemistry
Technical Details
Message-ID: <417@sdchema.sdchem.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!sdcsvax!sdchem!tps
References: <586@calma.UUCP> <4510@brl-smoke.ARPA> <3965@umcp-cs.UUCP> <414@sdchema.sdchem.UUCP> <4040@umcp-cs.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!sdcsvax!sdchem!tps
From: tps@sdchem.UUCP (Tom Stockfisch)
Newsgroups: net.lang.c
Subject: Re: Block Initialization
Message-ID: <417@sdchema.sdchem.UUCP>
Date: Thu, 30-Oct-86 00:27:17 EST
Article-I.D.: sdchema.417
Posted: Thu Oct 30 00:27:17 1986
Date-Received: Thu, 30-Oct-86 22:29:19 EST
References: <586@calma.UUCP> <4510@brl-smoke.ARPA> <3965@umcp-cs.UUCP> <414@sdchema.sdchem.UUCP> <4040@umcp-cs.UUCP>
Sender: news@sdchem.UUCP
Reply-To: tps@sdchemf.UUCP (Tom Stockfisch)
Distribution: na
Organization: UC San Diego
Lines: 42