Someone here asked a questions about the ||
operator. He wondered why (j=3) || (i=3)
did not assign 3 to i. That post is here: Determining the print of C
In my first answer to that question I gave this example for how this "feature" could be used:
ptr = malloc(sizeof(*ptr)) || printf("Error\n");
Yes, I know it should be printed to stderr, but that's not the topic. If I remember it correctly, I was told that this construct could cause memory leaks. I find it hard to believe, so please explain to me.
And is there any special reason to not use this construct? Apart from the obvious "because I can" impression it gives?