Comment

Comment by saagarjha

Short circuiting boolean operators are very useful, and not something I would consider a code smell. They let constructs like this work, which are very common in most codebases:

  if (foo && foo->bar) {
      // whatever
  }
An operator that did not short circuit would have undefined behavior because it might dereference a NULL pointer.
parent saagarjha 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton