Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Constants instead of #define #3

Closed
justinjdickow opened this issue Oct 24, 2014 · 2 comments
Closed

Use Constants instead of #define #3

justinjdickow opened this issue Oct 24, 2014 · 2 comments
Labels
best practice Not a defect but something that should be improved anyway
Milestone

Comments

@justinjdickow
Copy link
Contributor

The parameter key and value constants defined in SDLNames.h should use extern instead of define for safe compile time type checking and to avoid collisions.

Apple's Recommendation suggests

Define constants for strings used for such purposes as notification names and dictionary keys. By using string constants, you are ensuring that the compiler verifies the proper value is specified (that is, it performs spell checking).

@joeljfischer joeljfischer added enhancement best practice Not a defect but something that should be improved anyway labels Oct 24, 2014
@joeljfischer
Copy link
Contributor

Along with #7 I think this is part of a general overhaul of constants that may also include SDLEnums to be considered for making the library more internally consistent and consistent with platform best practices.

@joeljfischer joeljfischer changed the title SDLNames constants should use const instead of define Use Constants instead of #define Jan 16, 2015
@joeljfischer joeljfischer added this to the 4.0.0 milestone Feb 19, 2015
@joeljfischer joeljfischer modified the milestones: 5.0.0, 4.0.0 Mar 18, 2015
@joeljfischer
Copy link
Contributor

Additionally, these defines cause greater memory use because a new string is instantiated every time the macro is used; with constants only one string would be used.

davidswi pushed a commit to davidswi/sdl_ios that referenced this issue Nov 15, 2017
…0 to xevo_master

* commit '378a029e372c9bbed7648c55de1cb6148cd8edba':
  Catch UIApplicationWillTerminate in proxy and dispose to close EASession.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
best practice Not a defect but something that should be improved anyway
Projects
None yet
Development

No branches or pull requests

2 participants