🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #491

Re: AVL tree insertion - programming exercise

#491
From: Janis Papanagnou
Date: Sun, 18 Oct 2026 11:11
20 lines
2287 bytes
On 2026-10-18 10:42, Waldek Hebisch wrote:
>> [...]
> 
> I read the above as: "can access part of object that fits in allocated
> space".  That is important for structs and unions: you clearly do not
> want to allocate memory for biggest union variant.  [...]

Mind to explain that opinion?

If I define a (C-)'union' type I definitely want to store anything
possible in those unions, changing the value to another type as
necessary. - Mind the 'sizeof' of a union is [at least?] the size
of its largest component. - If I 'malloc' a union I use that size.
In cases where I want to use just one [smaller] component-type of
a union I just allocate that specific type not the union-type.

But maybe you meant something different?

Janis
Technical Details
Message-ID: <11b29gv$3pvda$3@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <86ece2kppv.fsf@linuxsc.com> <11amvh2$14pou$3@kst.eternal-september.org> <11ao2mr$4l9$1@reader2.panix.com> <11ap0fo$1t8gq$2@kst.eternal-september.org> <11aqnp0$sb$1@reader2.panix.com> <11arlj9$2q39c$1@kst.eternal-september.org> <20261015163445.76@kylheku.com> <11b20os$3qlbh$1@paganini.bofh.team>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: AVL tree insertion - programming exercise
Date: Sun, 18 Oct 2026 13:11:27 +0200
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <11b29gv$3pvda$3@dont-email.me>
References: <86ece2kppv.fsf@linuxsc.com>
 <11amvh2$14pou$3@kst.eternal-september.org> <11ao2mr$4l9$1@reader2.panix.com>
 <11ap0fo$1t8gq$2@kst.eternal-september.org> <11aqnp0$sb$1@reader2.panix.com>
 <11arlj9$2q39c$1@kst.eternal-september.org> <20261015163445.76@kylheku.com>
 <11b20os$3qlbh$1@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 18 Oct 2026 11:11:27 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3997098"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19ASJMhf1F/cinr8wHB9+d2"; posting-host="413ca35758bf2644217f2957a34a3916"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ErU22EQcSFe+1RlpVK+O21WkqUg= sha256:+dn3V8WRPL7chQNYpBtlFoQEINyk7dtB9luRrFzx+n4=
	sha1:Q/b1jTkq251Q7EDOksGq70DpqIE= sha256:43ispWr2thGKBDLanRXsXIlsLXGTgG63X0348Fow0uY=
Content-Language: en-US
In-Reply-To: <11b20os$3qlbh$1@paganini.bofh.team>