Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #13863

Re: Memory footprint of a structure of structures

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Memory footprint of a structure of structures
Date 2011-11-24 12:00 -0500
Organization A noiseless patient Spider
Message-ID <jalt87$4ph$1@dont-email.me> (permalink)
References <0364ed85-8bd9-4b42-9c74-86c4dd34adec@c18g2000yqj.googlegroups.com> <jailn0$uef$1@dont-email.me> <4ecd426e$0$4149$6e1ede2f@read.cnntp.org> <4ECD5A78.3010008@verizon.net> <4ece08fa$0$4150$6e1ede2f@read.cnntp.org>

Show all headers | View raw


On 11/24/2011 04:06 AM, Philipp Klaus Krause wrote:
> Am 23.11.2011 21:41, schrieb James Kuyper:
...
>> The C standard does mandate the sizeof operator, and it can be used to
>> create a program which, at run-time, will generate output like that
>> which he's asking for; I said as much in a later part of my message
>> which you snipped.
>>
>> The C standard does not mandate the existence of any feature that would
>> produce such output at compile time. The only output that normally
>> appears at compile time and is mandated by the C standard is diagnostic
>> messages, the text of which is not specified by the standard, nor under
>> the control of the developer - with the exception of the #error
>> directive. However, the #error directive is executed during phase 4;
>> sizeof expressions cannot be evaluated until phase 7, so the value of
>> such expressions cannot appear in #error output.
> 
> Well, sizeof, unless applied to a variable-length array, yields an
> integer constant. Which AFAIK, can be used e.g. as array bound. That's
> how I understood the OP's "would like, at compile time ideally, […], to
> know the footprint in memory" requirement.

I agree that, when VLAs are not involved, the compiler has sufficient
information to produce the result that he wants; I'm just letting him
know the C standard doesn't mandate support for any feature that would
have the desired effect.

-- 
James Kuyper

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Memory footprint of a structure of structures Jean-Michel Hautbois <jhautbois@gmail.com> - 2011-11-23 03:00 -0800
  Re: Memory footprint of a structure of structures James Kuyper <jameskuyper@verizon.net> - 2011-11-23 06:33 -0500
    Re: Memory footprint of a structure of structures Philipp Klaus Krause <pkk@spth.de> - 2011-11-23 19:58 +0100
      Re: Memory footprint of a structure of structures James Kuyper <jameskuyper@verizon.net> - 2011-11-23 15:41 -0500
        Re: Memory footprint of a structure of structures Ark <akhasin@macroexpressions.com> - 2011-11-23 23:59 -0500
          Re: Memory footprint of a structure of structures "Philip Lantz" <prl@canterey.us> - 2011-11-23 22:01 -0800
          Re: Memory footprint of a structure of structures James Kuyper <jameskuyper@verizon.net> - 2011-11-24 11:56 -0500
        Re: Memory footprint of a structure of structures Philipp Klaus Krause <pkk@spth.de> - 2011-11-24 10:06 +0100
          Re: Memory footprint of a structure of structures James Kuyper <jameskuyper@verizon.net> - 2011-11-24 12:00 -0500
            Re: Memory footprint of a structure of structures Jean-Michel Hautbois <jhautbois@gmail.com> - 2011-11-25 03:01 -0800
              Re: Memory footprint of a structure of structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-25 12:52 +0000
                Re: Memory footprint of a structure of structures "BartC" <bc@freeuk.com> - 2011-11-25 13:29 +0000
              Re: Memory footprint of a structure of structures James Kuyper <jameskuyper@verizon.net> - 2011-11-25 15:06 -0500
                Re: Memory footprint of a structure of structures Ark <akhasin@macroexpressions.com> - 2011-11-27 00:41 -0500
  Re: Memory footprint of a structure of structures Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-23 17:37 +0000
  Re: Memory footprint of a structure of structures Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-23 22:46 +0100
    Re: Memory footprint of a structure of structures Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-23 22:55 +0100
      Re: Memory footprint of a structure of structures Ark <akhasin@macroexpressions.com> - 2011-11-24 00:04 -0500
    Re: Memory footprint of a structure of structures Jean-Michel Hautbois <jhautbois@gmail.com> - 2011-11-24 00:39 -0800
    Re: Memory footprint of a structure of structures Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-24 10:34 +0000
      Re: Memory footprint of a structure of structures "BartC" <bc@freeuk.com> - 2011-11-24 12:18 +0000
        Re: Memory footprint of a structure of structures Jean-Michel Hautbois <jhautbois@gmail.com> - 2011-11-24 07:11 -0800
          Re: Memory footprint of a structure of structures jgk@panix.com (Joe keane) - 2011-11-25 22:08 +0000
            Re: Memory footprint of a structure of structures Ian Collins <ian-news@hotmail.com> - 2011-11-26 11:37 +1300
              Re: Memory footprint of a structure of structures jgk@panix.com (Joe keane) - 2011-11-27 23:20 +0000
        Re: Memory footprint of a structure of structures Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-27 10:17 +0000

csiph-web