delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/06/23:47:27

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Memory leak.
Date: Mon, 06 Oct 1997 19:30:03 -0700
Organization: Alcyone Systems
Lines: 23
Message-ID: <34399EAB.771DFCBB@alcyone.com>
References: <3 DOT 0 DOT 16 DOT 19971003101449 DOT 36e7aec2 AT hem1 DOT passagen DOT se> <613s4d$hrm AT dfw-ixnews3 DOT ix DOT netcom DOT com> <3435E44A DOT 5C65B10B AT alcyone DOT com> <3436785d DOT 8243393 AT news DOT uni-duisburg DOT de> <616g9n$i7 AT dfw-ixnews11 DOT ix DOT netcom DOT com> <3439043e DOT 32895652 AT news DOT uni-duisburg DOT de>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Michael Mauch wrote:

> Yes, you're right. I didn't test it and `sizeof int´ really doesn't
> work, whereas `char c; x = sizeof c;´ does. I'm sorry.

Correct.  The relevant section of the ANSI C standard is 6.3.3.4:

    The sizeof operator yields the size (in bytes) of its operand, which
    may be an expression or the parenthesized name of a type.  The size
    is determined from the type of the operand, which is not itself
    evaluated.  The result is an integer constant.

Since a variable name is an expression, you don't need parentheses for
it.

-- 
          Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                        Alcyone Systems / http://www.alcyone.com/max/
   San Jose, California, United States / icbm://+37.20.07/-121.53.38
                                      \
   "After each war there is a little / less democracy to save."
                                    / Brooks Atkinson

- Raw text -


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