🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9580

Re: Block Initialization

#9580
From: Pedz Thing
Date: Mon, 13 Oct 1986 20:56
36 lines
1719 bytes
In article <586@calma.UUCP> swang@calma.UUCP (Sin-Yaw Wang) writes:
>What is the most suitable (fast and portable among versions of Unix)
>way to do block initialization?
>

If you have an extra 4k of memory space I do the following:

----------
static struct bigstruct zerobigstruct;

main()
{
  struct bigstruct tobeused;

  tobeused = zerobigstruct;
  ...
}
----------

The above code obviously assumes that the compiler has structure
assignment which I think is a pretty safe assumption if you are
dealing with C compilers on Unix machines.

I realize that this is going to start the big debate about assignment
of structures being either field by field or a block move.  Lets not
get into that argument please.  My point here is if the compiler feels
a block move for the above code is correct then it can produce that.
If the compiler prefers field by field assignment, it can produce
that.  (I personally assume the above code produces a block move and
if that is not what I want, then I must explicitly tell the compiler
otherwise).
-- 
Perry Smith
ctvax ---\
megamax --- bobkat!pedz
pollux---/
Technical Details
Message-ID: <161@bobkat.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!rutgers!caip!clyde!cuae2!ltuxa!we53!sw013b!dj3b1!killer!ndmce!pollux!bobkat!pedz
References: <586@calma.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!columbia!rutgers!caip!clyde!cuae2!ltuxa!we53!sw013b!dj3b1!killer!ndmce!pollux!bobkat!pedz
From: pedz@bobkat.UUCP (Pedz Thing)
Newsgroups: net.lang.c
Subject: Re: Block Initialization
Message-ID: <161@bobkat.UUCP>
Date: Mon, 13-Oct-86 16:56:02 EDT
Article-I.D.: bobkat.161
Posted: Mon Oct 13 16:56:02 1986
Date-Received: Fri, 17-Oct-86 03:36:17 EDT
References: <586@calma.UUCP>
Reply-To: pedz@bobkat.UUCP (Pedz Thing)
Distribution: na
Organization: Digital Lynx; Dallas, TX
Lines: 36