There are 53 messages in this thread.
You are currently looking at messages 50 to 53.
CBFalconer wrote: > I trust you meant 243. You can also quickly multiply by 3 on very > simple hardware, by shift and add twice. yes thanks! 243 W4tch3r ‹•¿•›
Chris H wrote: > In message > <b...@26g2000hsk.googlegroups.com>, > Tomás Ó hÉilidhe <t...@lavabit.com> writes >> On May 13, 7:59 pm, Hans-Bernhard Bröker <HBBroe...@t-online.de> >> wrote: >>> > #define TOTAL_BITS_NEEDED (QUANTITY_CHUNKS * BITS_PER_CHUNK) >>> >>> Bad macro. Parentheses missing around QUANTITY_CHUNKS and >>> BITS_PER_CHUNK leave the code vulnerable to funny definitions of those >>> constants (e.g. #define BITS_PER_CHUNK 2+3) The same problem occurs >>> repeatedly later on. >> >> You're confusing things. A macro is a self-contained, self-sufficient >> entity. If I have a macro called QUANTITY_CHUNKS, then it should be >> able to be used on its own without parentheses. If it needs >> parentheses, then it is ill-formed. > > Now you are running counter to most standards and guides for portability > and safety. I suspect Chris misunderstands Tomas's point: that macros defining numeric expressions should have surrounding parentheses in the macro definition so they aren't required where they are used. So #define FOO (BAR+3) x = FOO+4; rather than #define FOO BAR+3 x = (FOO)*4; Hans-Bernard's point, of being paranoid of externally-defined macros and surrounding those with parentheses is good, of course. -- Thad