The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Representative comment

Last post 06-24-2009 5:13 AM by boh. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 06-22-2009 6:05 PM

    Representative comment

    /* Font names are stored as null-terminated UTF-16 Pascal strings. */
  • 06-22-2009 7:27 PM In reply to

    Re: Representative comment

    Wow, I think I can count at least four things wrong with that one comment. Now, I guess that that comment is in the middle of a global data header file, as opposed to being in the planning documentation?

    morbiuswilters: Oh, and this entire thread is pointless, flamebait spam. Heckuva job, drachy...
    Prepare for a life in hell, a thankless job where you service the dregs of society. Kinda like being a hooker that works in a crack house.

    "we don't appreciate political/nationalist/technology flamebaiting here, please do not do this" and this is why mods shouldn't be able to permanently delete threads... some of us can't read the historical entries and see what the problem was...
  • 06-22-2009 8:25 PM In reply to

    Re: Representative comment

    drachenstern:

    Wow, I think I can count at least four things wrong with that one comment. Now, I guess that that comment is in the middle of a global data header file, as opposed to being in the planning documentation?

    Would be nice if it was, but no, the header comment on that field is the entirely non-helpful
    pg_char	 	name[FONT_SIZE + BOM_HEADER];		/* "Name" of font */
    The comment I posted was found in the middle of a code file, explaining why the font name was being accessed as &font->name[1] rather than font->name.
  • 06-22-2009 9:50 PM In reply to

    Re: Representative comment

    Carnildo:
    /* Font names are stored as null-terminated UTF-16 Pascal strings. */
     

    So what's your problem?  I'd die for comments like that!  It's a Pascal string -- that means it has a leading length count, probably 2 bytes long (pg_char type in your example).  Then the data also has a null terminator, probably actually two nulls.  This makes it more easily usable from a C context.  Then it tells you that it's in UTF-16 encoding.

    I repeat, so what's your problem?

  • 06-22-2009 11:11 PM In reply to

    Re: Representative comment

     Why bother null terminating it if you've got a length count?

  • 06-22-2009 11:20 PM In reply to

    Re: Representative comment

     

    vt_mruhlin:

     Why bother null terminating it if you've got a length count?

    Didn't Joel Sposky call those Fucked Strings once?

    They'll get out of sync if the string is at all mutable.

    Filed under:
  • 06-23-2009 12:14 AM In reply to

    Re: Representative comment

    vt_mruhlin:

     Why bother null terminating it if you've got a length count?

     

    Because you can simply pass them to WinAPI.

  • 06-23-2009 10:09 AM In reply to

    Re: Representative comment

    UpNDown:

    So what's your problem?  I'd die for comments like that!  It's a Pascal string -- that means it has a leading length count, probably 2 bytes long (pg_char type in your example).  Then the data also has a null terminator, probably actually two nulls.  This makes it more easily usable from a C context.  Then it tells you that it's in UTF-16 encoding.

    I repeat, so what's your problem?

    That we still don't know whether it's UTF-16BE or UTF-16LE!

    Duhhhhhhhh

    ╩юфют√ь ёЄЁрэшЎрь яюЁр эр яхэёш■.

    #TDWTF @ SlashNET was merged into #codelove @ the same network. You're still welcome to drop by. I guess.
    Filed under: ,
  • 06-24-2009 5:13 AM In reply to

    • boh
    • Not Ranked
    • Joined on 03-05-2007
    • Posts 46

    Re: Representative comment

    Carnildo:
    /* Font names are stored as BSTR:s. */



    There, FTFY.

Page 1 of 1 (9 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems