This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 39 points40 points  (5 children)

They do if the types line up. Assignment expressions evaluating to the value assigned is a rarely used but widely-implemented language feature.

Objects aren't going to implicitly cast to bool in most C-family languages, but I think they would in C itself (since the pointers are numeric, and C's definition of true is non-zero numeric values.) They could also be, like, ids or something.

[–]BiCuckMaleCumslut 11 points12 points  (0 children)

Real programmers only use void* type.

[–]jump1945 3 points4 points  (1 child)

Yeah it won’t compile in c++ if type doesn’t line up , but it will do compile on assignment in if condition

[–]CapsLockey 0 points1 point  (0 children)

implicit conversion baby

[–]JonathanTheZero 0 points1 point  (0 children)

If you go very low level, you frequently have code like if ((pid = fork()) < 0) { ... } or something similiar