This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Ziemowit Laski wrote:
The semantics are that a C-style cast of an lvalue will itself be treated as an lvalue under the following circumstances:
Thanks for your description, but I find it incomplete.
- The lvalue cast does not induce a type conversion (if it does, then we use the type conversion instead);
You can't possibly mean this. If the cast does not change the type, then
there's no reason to have it there. Clearly some type conversions are
permitted and some not -- please be specific about which. May be
you meant integral conversion, maybe you meant integral-pointer conversions
maybe you meant integral promotion ...
- The lvalue cast is being assigned to, incremented or decremented;... or modified. What is the bitrepresentation of the lvalue? Is it
that of the newly specified type, or is the static type of the location?
- The lvalue is of a pointer type, and is being cast to a pointer type.ok, so this answers my questions about point 1. Any pointer type? Like the disallowed func->object conversion in C++? What about references and/or references to pointer types? Does array/function->pointer decay occur? It might make sense to restrict the original lvalue type to 'void *'.
Are there any restrictions on the original lvalue that is being cast?
Is this extension composable? For instance what about the following, #define MAGIC_REGISTER ((void *)p) (int *)MAGIC_REGISTER += 2
What about (expr, (int *)p) = something in C++? In C++ operator, is an lvalue if its second operand is an lvalue. Similarly for ?:
Have you thought about specifying this in terms of a rewriting rule?
Do you have an analysis of interaction with existing features?
What programming errors would fall into this?
Why do you want this extension? I see 6 different possible rationales. Are they all applicable?
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |