Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for answer to Why is sizeof considered an operator? by Steve Jessop

Current License: CC BY-SA 3.0

Post Revisions

12 events
when toggle format what by license comment
Aug 1, 2021 at 17:18 comment added Aykhan Hagverdili printf("%d\n", sizeof a) is not perfectly fine. %d is the wrong specifier. It has undefined behavior.
Jun 5, 2017 at 12:22 history edited Steve Jessop CC BY-SA 3.0
added 9 characters in body
May 30, 2017 at 1:13 comment added Jonathan Leffler The standard uses two notations for sizeof: sizeof unary-expression and sizeof ( type-name ) — so in the C11 standard it is not deemed to be a 'cast' but a parenthesized type name. The net result is much the same. (For comparison, a cast expression is ( type-name ) cast-expression.) And I hate the way that comment Markdown works differently from Q&A Markdown!
Oct 10, 2016 at 9:07 comment added glglgl @anatolyg My comment was long ago, I suppose I was trying to be sarcastic then.
Oct 7, 2016 at 19:09 comment added anatolyg @glglgl No, that doesn't make any sense. In that context, (int) is nothing fancy - just a name of a type inside parentheses. Parentheses here are a part of the syntax of sizeof - they are required when taking the size of a type, but not required when taking the size of an expression. See e.g. here
Jan 27, 2015 at 10:53 comment added Aaron McDaid I believe things are more complex nowadays due to variable-length arrays (VLA). IIRC, the standard would even allow sizeof to have side effects if there is a VLA in the expression.
Sep 8, 2009 at 12:41 history edited Steve Jessop CC BY-SA 2.5
added 30 characters in body; added 61 characters in body; deleted 61 characters in body
Sep 8, 2009 at 12:33 history edited Steve Jessop CC BY-SA 2.5
added 271 characters in body; edited body; added 33 characters in body
Sep 8, 2009 at 12:05 vote accept Arpit
Sep 8, 2009 at 12:03 history edited Steve Jessop CC BY-SA 2.5
added 94 characters in body
Sep 8, 2009 at 11:58 comment added crashmstr Wow, just what I was thinking!
Sep 8, 2009 at 11:58 history answered Steve Jessop CC BY-SA 2.5

AltStyle によって変換されたページ (->オリジナル) /