
C preprocessor expressions - ingve
http://fanf.livejournal.com/139158.html
======
TazeTSchnitzel
You can't have a float constant without an identifier? Huh? What is 0.5f,
then?

~~~
pascal_cuoq
> What is 0.5f, then?

Since the article is about C preprocessor expressions and it says that in that
context, there can't be any of them, I would say the answer is: “not a C
preprocessor expression”.

~~~
TazeTSchnitzel
The article says this:

> And there can't be any casts because you can't write a type without at least
> one identifier. [...] And since there can't be any casts, there can't be any
> floating constants.

It says that there can't be floating-point constants _because there aren 't
casts_.

But I just demonstrated a way to make a floating-point constant without a
cast: 0.5f. Thus, surely, the statement that there can't be floating-point
constants is wrong, since the only objection to them presented is that you
need casts to construct them?

Edit: Ah, now I see the problem.

> An integer constant expression shall have integer type and shall only have
> operands that are [...], and floating constants that are the immediate
> operands of casts

Since you can only have a float constant that's an immediate operand of a
cast, and since you can't have casts, you can't have floats. Aha :)

