Path: csiph.com!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail From: nobody@example.org (Scott) Newsgroups: comp.lang.c Subject: Re: Static Arrays Inside Functions Date: Mon, 29 Apr 2019 01:17:21 GMT Organization: XMission http://xmission.com/ Message-ID: <5cc64ce6.3574620423@core> References: <5cc5e100.3546998829@core> Injection-Info: news.xmission.com; posting-host="shell.xmission.com:2607:fa18:0:beef::4"; logging-data="28834"; mail-complaints-to="abuse@xmission.com" X-Newsreader: Forte Free Agent 1.21/32.243 Xref: csiph.com comp.lang.c:143518 On Sun, 28 Apr 2019 11:29:14 -0700, Keith Thompson wrote: >nobody@example.org (Scott) writes: >> On 27 Apr 2019 17:52:24 GMT, "F. Russell" wrote: >>>Will the array be initialized during compile time so that the >>>function code contains the values? >> >> Not to belabor the obvious related issue, but if you have *any* >> initialized variable, where would you expect those initializing values >> to be stored if not in the object code? > > { > int r = rand(); > time_t now = time(NULL); > } > >The initial values of r and now are not stored in the object code. >They're computed at run time. A fair point, but those aren't initializing *values*, are they? And that's not quite what I was getting at in any case. Most programmers would quickly intuit that object code must necessarily contain all the information it needs for all of its initializations. I was curious about the thinking behind the question of whether the "code contains the values", wondering where that line of thinking might lead. You'll have to forgive me though. I've had a lot of IRL contact with beginner programmers lately, and some of them have some truly baffling notions.