Skip to content

Problems

Jack edited this page Dec 18, 2016 · 5 revisions

Code Bloat

Problem

JCRL provides a very simple and clean error system: return values are all standard return codes (defined in constants.h). This makes it easy to check for failure and what kind of failure occurred. Ideally, every JCRL function call has its return value checked and any errors are caught and handled.

However, this can inflate code using JCRL by quite a bit. Not only is this bad for software maintenance and complexity, but it adds insult to injury as programmers are essentially punished for using the library safely!

Possible Solutions

  • Define a macro (or set of macros) that would condense common error checking down into a single line
  • Define a special function that would condense common error checking down into a single line

The first option seems like the better of the two as macros are quite flexible and don't pollute the function namespace (like the second option).

Clone this wiki locally