[erlang-questions] erlang:max/2 and erlang:min/2

Tony Rogvall tony@REDACTED
Sat Sep 11 15:10:16 CEST 2010


> 
> The ternary operator can also be used as an l-value (for fun and profit) :)
> ((A >= B) ? A : B) = 123; // Don't do this.. otherwise your coworkers will
> want to kill me for teaching you

Ultra cool.
This is perfect for obscure programming. I will integrate this in the standard workflow here at the office!

Sadly gcc complains a bit about this!
tassign.c:12: warning: target of assignment not really an lvalue; this will be a hard error in the future

with the option -fno-non-lvalue-assign
This will generate error:

tassign.c:12: error: lvalue required as left operand of assignment

Unfortunately I could not find any option to turn off the irritating warning.

Thanks ;-)

/Tony




More information about the erlang-questions mailing list