Re: Just for your fun and horror

At 2001-02-17 19:50, Manuel M. T. Chakravarty wrote:
It is
bar = 42
for which C has no corresponding phrase.
Hmm... #define bar 42 ...although I would always do const int bar = 42 -- Ashley Yakeley, Seattle WA

Ashley Yakeley
At 2001-02-17 19:50, Manuel M. T. Chakravarty wrote:
It is
bar = 42
for which C has no corresponding phrase.
Hmm...
#define bar 42
No - this doesn't work as #define bar (printf ("Evil side effect"), 42) is perfectly legal. So, we have an implicit IO monad here, too. What is interesting, however, is that C does not require `return' in all contexts itself. Or in other words, C's comma notation has an implicit `return' in the last expression.
...although I would always do
const int bar = 42
That's a good one, however. It in effect rules out side effects by C's definition of constant expressions. So, I guess, I have to extend my example to bar x = x + 42 Cheers, Manuel
participants (2)
-
Ashley Yakeley
-
Manuel M. T. Chakravarty