delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/18/13:00:16

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: calculating size (like sizeof in TurboC++)
Date: Sun, 18 Jun 2000 16:51:18 GMT
Organization: always disorganized
Lines: 21
Message-ID: <394cfdf2.35169241@news.freeserve.net>
References: <w3L25.77278$yR DOT 1322670 AT news DOT chello DOT at> <642A954DD517D411B20C00508BCF23B0012B16CF AT mail DOT sauder DOT com> <394CDAD3 DOT 2B075EC3 AT crosswinds DOT net>
NNTP-Posting-Host: modem-185.utah.dialup.pol.co.uk
X-Trace: news5.svr.pol.co.uk 961347078 9067 62.137.95.185 (18 Jun 2000 16:51:18 GMT)
NNTP-Posting-Date: 18 Jun 2000 16:51:18 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Cherniavsky Beni wrote:

> > > I recently started programming with djgpp+allegro and now I'd like to know
> > > what function djgpp provides for calculating the size of a variable ( like
> > > sizeof()).
> > 
> > The sizeof operator is standard C, so DJGPP supports it.
> > 
> > S.
> 
> It might be useful to emphasize that sizeof(expression) is not a function that
> can be implemented by any library but an *operator*.  It is computed at
> *compile time* as a property of the type of the expression (which is never
> computed).

This is true in C89/C90.  But note that C99 has variable length arrays,
and sizeof applied to such an array is computed at execution time.
Moreover, DJGPP (or rather gcc) already supports this, even though it
is as yet a long way from being C99-compliant.

S.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019