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


Groups > comp.lang.c > #18288

Re: sizeof((type)) is a constraint violation?

From Nils M Holm <news2009@t3x.org>
Newsgroups comp.lang.c
Subject Re: sizeof((type)) is a constraint violation?
Date 2012-03-07 14:47 +0000
Organization TARFU
Message-ID <9rpaohFc5sU1@mid.individual.net> (permalink)
References <jj7phr$ghu$1@dont-email.me>

Show all headers | View raw


Noob <root@127.0.0.1> wrote:
> Obviously, the compiler dislikes the double parenthesis
> around a type-name.
> 
> Does this mean ((int)) cannot be takes as a unary-expression?

((int)) is not a parenthesized primary expression, it is a
parenthesized type cast, which is not a sentence that can
be produced by the ANSI C grammar (as specified in The C
Programming Language, 2nd Ed).

((int) x) would be a primary expression and would be accepted
as an operand of 'sizeof'. More parens around the expression can
be added to suit your taste.

> However ((x)) or ((42)) are valid instances of unary-expression?

These, on the other hand, /are/ primary expressions.

-- 
Nils M Holm  < n m h @ t 3 x . o r g >  www.t3x.org

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


Thread

sizeof((type)) is a constraint violation? Noob <root@127.0.0.1> - 2012-03-07 14:58 +0100
  Re: sizeof((type)) is a constraint violation? Nils M Holm <news2009@t3x.org> - 2012-03-07 14:47 +0000
    Re: sizeof((type)) is a constraint violation? Keith Thompson <kst-u@mib.org> - 2012-03-07 12:51 -0800
      Re: sizeof((type)) is a constraint violation? Nils M Holm <news2009@t3x.org> - 2012-03-08 06:15 +0000
  Re: sizeof((type)) is a constraint violation? China Blue Water Navy <chine.bleu@yahoo.com> - 2012-03-07 07:11 -0800
  Re: sizeof((type)) is a constraint violation? Keith Thompson <kst-u@mib.org> - 2012-03-07 12:44 -0800

csiph-web