1. It's a long, you fool! 2. No, it's an int! 3. Goto 1



  • A mild WTF from Apple's XCode: I'm creating a formatted string with the error code. The error code is of type OSStatus, which is an int:

    no it ain't

    Oh, it's a long. Well, let's make that %ld then:

    neither

    A female compiler, who would have guessed.



  • Reminds me of something I'd see on http://www.textfromxcode.com/ :P



  • Using %ld and an explicit cast to long should be safe and shut the stupid thing up.



  • @TGV said:

    A female compiler, who would have guessed.

    Hey look a misogynist, who would have guessed.



  • @blakeyrat said:

    Hey look a misogynist, who would have guessed.
     

    Amen. And even outside the misogynist aspect, it's as overused and clever as xkcd references with link to a strip.



  • @blakeyrat said:

    Hey look a misogynist, who would have guessed.
    Hey look, a nerd without girl friend!



  • @TGV said:

    @blakeyrat said:

    Hey look a misogynist, who would have guessed.
    Hey look, a nerd without girl friend!

    Hey look: popcorn! munchmunchmunch



  • XCode has a problem, but it's in the way it is telling you of the issue (and in the fix-its, which are likely not helpful either). The explanation is your code is compiled twice (at least): once in 32 bit, once in 64 bit, and fixing the warning in the way it likely was suggested to you creates the other warning in the other mode; the inline warnings and errors in XCode are generally nice, but they still have work to do at Apple before people can just rely on them instead of having to double-check the warning from the actual build logs to be certain of what the problem is.

    For hysterical historical reasons*, 32-bit integers like OSStatus are defined as long in 32-bit mode, but to stay 32-bit in the LP64 model these integers are defined as int in 64-bit compilation. Hence the proper solution is to specify the %ld format and cast to (long); I always do so when I printf 32-bit quantities (which gets to be a little bit annoying when I have to type (unsigned long) each time, because my amounts are generally unsigned).

     *back in the 68k days, an int was 16 bits



  • @TGV said:

    A female compiler, who would have guessed.

     

     

    Fuck you.



  •  Well spoken!



  • @ZPedro said:

    XCode has a problem, but it's in the way it is telling you of the issue (and in the fix-its, which are likely not helpful either). The explanation is your code is compiled twice (at least): once in 32 bit, once in 64 bit, and fixing the warning in the way it likely was suggested to you creates the other warning in the other mode; the inline warnings and errors in XCode are generally nice, but they still have work to do at Apple before people can just rely on them instead of having to double-check the warning from the actual build logs to be certain of what the problem is.

    For hysterical historical reasons*, 32-bit integers like OSStatus are defined as long in 32-bit mode, but to stay 32-bit in the LP64 model these integers are defined as int in 64-bit compilation. Hence the proper solution is to specify the %ld format and cast to (long); I always do so when I printf 32-bit quantities (which gets to be a little bit annoying when I have to type (unsigned long) each time, because my amounts are generally unsigned).

     *back in the 68k days, an int was 16 bits

    I hadn't realized that. Thanks for the explanation.

    Ah, the 16 bit int days. OSStatus was called OSErr back then, I think. Who needs 2^32 status codes anyway?



  • @TheLazyHase said:

    @blakeyrat said:

    Hey look a misogynist, who would have guessed.
     

    Amen. And even outside the misogynist aspect, it's as overused and clever as xkcd references with link to a strip.

     

    That reminds me of [url="http://xkcd.com/322/"]this xkcd[/url].

     


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.