Representative lines



  • #define SUCCESS 0

    And of course there is also

    #define FAILURE 1

    Not that I should complain, this client will keep me busy for a long time...



  • So you're looking for a new mug?


  • Discourse touched me in a no-no place

    @tok said:

    #define SUCCESS 0

    And of course there is also

    #define FAILURE 1

    Not that I should complain, this client will keep me busy for a long time...

    I'm failing to see the WTF - certainly within C.



    If a function returns a status, 0 should mean success, with different non-zero numbers potentially giving an indication of the failure. cf EXIT_SUCCESS and EXIT_FAILURE



    Conversely if a function returns a pointer, 0 generally does mean failure (with errno set to indicate the failure.)



  • @PJH said:

    I'm failing to see the WTF - certainly within C.


    If a function returns a status, 0 should mean success, with different non-zero numbers potentially giving an indication of the failure. cf EXIT_SUCCESS and EXIT_FAILURE

    Conversely if a function returns a pointer, 0 generally does mean failure (with errno set to indicate the failure.)

    There are various patterns for function return values. One is "zero for success, otherwise an error code". Another is "nonzero for success, zero for failure". Yet another is "pointer to something or NULL for failure / no such thing / not applicable / whatever". Which one "should" be used depends on what is natural for the occasion

     The thing is, these people only use the return value for success/failure. And they also use function calls as predicates, which leads to interpreting "true" (in the C sense) function returns as failures.

     I find it poetic justice that they #define SUCCESS 0, given the overall quality of the code. They truly are having zero success.



  • So the wtf is that they aren't giving useful error codes?



  • Maybe the WTF is that that's JavaScript code!



  • /*********************************************************************
    *                                                                    *
    *   winerror.h --  error code definitions for the Win32 API functions*
    *                                                                    *
    *   Copyright (c) Microsoft Corp.  All rights reserved.              *
    *                                                                    *
    *********************************************************************/
    
    [...]
    
    //
    // MessageId: ERROR_SUCCESS
    //
    // MessageText:
    //
    //  The operation completed successfully.
    //
    #define ERROR_SUCCESS                    0L
    


  • @blakeyrat said:

    Maybe the WTF is that that's JavaScript code!
     

    not sure if joke



  • @dhromed said:

    @blakeyrat said:
    Maybe the WTF is that that's JavaScript code!
    not sure if joke

    It's not as good a joke as YOUR FACE!

    I dunno, it doesn't seem very WTF to me. So I figured, hey if it was JavaScript it would be hugely WTF!



  • @blakeyrat said:

    @dhromed said:
    @blakeyrat said:
    Maybe the WTF is that that's JavaScript code!
    not sure if joke

    It's not as good a joke as YOUR FACE!

    I dunno, it doesn't seem very WTF to me. So I figured, hey if it was JavaScript it would be hugely WTF!

     

    You suck.

     



  • You want a real preprocessor WTF?

    /*
     *	RICHEDIT.H
     *	
     *	Purpose:
     *		RICHEDIT v2.0/3.0/4.0 public definitions
     *		functionality available for v2.0 and 3.0 that is not in the original
     *		Windows 95 release.
     *	
     *	Copyright (c) Microsoft Corporation. All rights reserved.
     */
    

    [...]

    // This is a hack to make PARAFORMAT compatible with RE 1.0
    #define wReserved wEffects

    [...]

    There! WTF!


Log in to reply