[Python-Dev] are NULL checks in Objects/abstract.c reallyneeded?
Tim Peters
tim.one@comcast.net
Thu, 13 Mar 2003 16:20:52 -0500
Thu, 13 Mar 2003 16:20:52 -0500
- Previous message: [Python-Dev] are NULL checks in Objects/abstract.c reallyneeded?
- Next message: [Python-Dev] are NULL checks in Objects/abstract.c reallyneeded?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Skip Montanaro] > It's not clear to me that you'd see any benefit anyway. The checking code > currently looks like this: > > if (o == NULL) > return null_error(); > > If you changed it to use assert you'd have > > assert(o != NULL); > > which expands to > > ((o != NULL) ? 0 : __assert(...)); > ... In the release build, Python arranges to #define the preprocessor NDEBUG symbol, which in turn causes assert() to expand to nothing (or maybe to (void)0, or something like that, depending on the compiler). That's standard ANSI C behavior for assert(). IOW, asserts cost nothing in a release build -- and don't do anything in a release build either.
- Previous message: [Python-Dev] are NULL checks in Objects/abstract.c reallyneeded?
- Next message: [Python-Dev] are NULL checks in Objects/abstract.c reallyneeded?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]