projektir / cpp-blocks

Simple block dropping game implemented with SDL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove try/catch clauses

projektir opened this issue · comments

Not really a best practice.

Don't think there is anything wrong with try/catch, the issue probably is having try/catch as the immediate function body instead of the more traditional block.

int foo() try {
  ..
} catch(..) {
  ..
}

->

int foo() {
  try {
    ..
  } catch(..) {
    ..
  }
}

If try/catch in general is bad, then that's something I didn't know before and would love to hear more about!

I think they're not great because most of them right now would just hide issues.

Ah, in that case yes. The one I saw did print the error and returned 0/1 depending on what was going on.