Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Variable-length messages. Message-ID: <8721@smoke.BRL.MIL> Date: 22 Oct 88 19:19:42 GMT References: Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 13 In article ljz%fxgrp.fx.com@ames.arc.nasa.gov (Lloyd Zusman) writes: >Is it really a no-no to use the 'msgBody[1]' construct as defined above? Well, it's like this. It is not a practical problem on an architecture that provides a single, uniform, flat data address space. However, on other architectures it could fail to work, because the compiler is entitled to assume that there is no data to be referenced beyond the bounds of the structure and it could therefore generate code that will fail when such an access is attempted. I won't bore you with details. Most programmers would probably make that structure member a pointer to malloc()ed storage, which introduces slightly more overhead but has the virtue of being portable.