News for hackers. Stuff that matters.
Re:A Gentle Primer on Reverse Engineering by zrail on Wednesday January 28, 2015 @07:47PM (#8963643)
Let's look at the source of stdbool.h:

    #define true 1
    #define false 0
http://clang.llvm.org/doxygen/stdbool_8h_source.html
Re:A Gentle Primer on Reverse Engineering by delinka on Thursday January 29, 2015 @09:37AM (#8966313)
That simply explains the truth behind the words. Re-type-ing basic types into other names gives us the ability to share intent without commentary. A function returning 'bool' is intended to be treated as having two valid return values. A function returning int might be intended to return any of the large rage of values that int can support.
Re:A Gentle Primer on Reverse Engineering by samsaga2 on Thursday January 29, 2015 @02:25AM (#8964798)
You're missing

   #define bool _Bool
Since bool wasn't reserved prior to C99, they use the _Bool keyword (which was reserved). [http://stackoverflow.com/questions/8724349/difference-betwee...]
Re:A Gentle Primer on Reverse Engineering by AlexeyBrin on Wednesday January 28, 2015 @07:54PM (#8963671)
I know that sdtbool actually contains macros for defining true and false, but _Bool is a new type in C99 ... But it is in the standard, implemented by all major compilers, so it should be used for the sake of clarity.

IMHO this:

    bool is_valid(char* password);
is more clear than this:

    int is_valid(char* password);
Re:A Gentle Primer on Reverse Engineering by zrail on Wednesday January 28, 2015 @07:56PM (#8963682)
But here's the thing: in the assembly (the very essence of the essay), booleans are still represented as integers. Using a standard macro would obfuscate the path to getting to the payoff of being able to switch a single byte from 0 to 1 and crack the program, because the author would then have to explain macros and delve into a bunch of ancillary stuff.
Re:A Gentle Primer on Reverse Engineering by farmdve on Wednesday January 28, 2015 @07:58PM (#8963690)
Starting to work with Reverse Engineering assumes prior knowledge of programming and/or some basic information about assembly for the specific platform.

Furthermore as the examples are given in C, it is implied that the reader needs to be familiar with the language, and as a consequence, knowing about macros, should be if not a given, then at least required.

Re:A Gentle Primer on Reverse Engineering by zrail on Wednesday January 28, 2015 @08:03PM (#8963714)
The original audience of this content (i.e. not HN) is a broad interest group so you can't really assume that kind of knowledge. Again, think "hey this is neat!" vs "this is absolutely technically correct in all ways."
Re:A Gentle Primer on Reverse Engineering by unwind on Thursday January 29, 2015 @07:54AM (#8965770)
Of course it should be bool.

I'm glad that the OP at least made it a const char *password though, since that's also a must-have. Always const input pointers. And local temporaries. And everything else that you can const, except scalar arguments pretty much.

Re:A Gentle Primer on Reverse Engineering by userbinator on Wednesday January 28, 2015 @08:43PM (#8963850)
Given that more than half of that file is a copyright comment, and the other half basically has to follow a standard exactly, it almost makes me wonder if it meets the minimum threshold of creativity to be copyrightable.