Re: War on magic numbers
Bj|rn Englund <[email protected]> Sat, 4 Nov 2006 15:37:38 +0100
| Newsgroups | gmane.comp.video.ogle.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi. Sat Oct 28 2006, Justin Moore wrote: > > Too many places in the codebase have "magic numbers": hard-coded > constants that should really be replaced with #define'd values or > enum'ed values. A few questions: > > o do you prefer #define'd values or enums? For these things probably #defines if you don't have a particular reason to use enums. > > o should I create a separete dvdread/constants.h or should I place the > values in the header file that matches the .c file in which they're > contained (e.g., FPS_2500 and FPS_2997 go in ifo_print.h or should I put > everything in *_types.h? Things that has to do with fields in ifo_types.h should go in ifo_types.h like video_format in video_attr_t: #define xxxx_VIDEO_FORMAT_NTSC 0 #define xxxx_VIDEO_FORMAT_PAL 1 Things that are internal to libdvdread should not be put in the installed header files. There should be a naming scheme. We need a prefix for the defines in installed header files. Instead of only VIDEO_FORMAT_NTSC it should probably be called DVDREAD_VIDEO_FORMAT_NTSC or something like that. > > o what is the patch submission process? > Send the patches to the ogle-devel list. (Keep them small, don't submit unrelated changes in the same patch, everything should compile after each patch is applied) /Bj|rn