In Table 2, the remarks sometimes mention that the pointer types must be identical (or void* or null). I thought that “void*” would work with any other pointer, e.g. testing if a pointer is greater than null is the equivalent to “… != NULL”. Is this not the case?
- When void* or null is not explicitly mentioned, does this mean that this is not valid?
- Does identical mean that the types are the same (e.g. int is not identical to char) or implicitly convertible (e.g. int <> char, but int <!> char*)?
by == or != of binaryExpression, char*/int*/void* == 0 is valid?
if so, how can I check if the right Expression from the binaryExpression is 0…
should i just use this.getRight.toString == “0”? or this.getRight == null??
this.getRight.toString == “0”
You would probably want to use
.equals and pick the right string, but this could work. However, I would not do this.
this.getRight == null
This would mean that the right hand side does not exist, which should not happen. It’s certainly not what you want.
Instead, I would recommend putting a method like
isNullConstant or similar in your
You can even have it return
false by default, and you only need to overwrite that for integer constants.
Of course, other options are also possible.
alles Klar, thanks very much