:: Re: [DNG] Ada
Top Page
Delete this message
Reply to this message
Author: aitor
Date:  
To: dng
Subject: Re: [DNG] Ada
Hi,

On 4/6/26 09:55, Didier Kryn wrote:
> But this leads to dangerous constructs like "if(n=0)" being valid


`if (n = 0)` would return always 0 (i.e. false) without compiler warnings unless you use the flag `-Wall`. Whereas `if (n = 1)` would return always true.

This is why some programmers prefer to write `if (0 == n)`. If you forget the `=`, the code `if (0 = n)` will result in a compilation error because it's
not possible to assign a value to a constant.

Aitor.