Strings from space



  • Hi
    In another case of 20 times the same year of experience, I (the junior) lost hours today to understand why my code (Java) wasn't working.

    I have an enum with a couple strings that are reported by the hw driver, but none of them would match. And then I decided to double check the "Senior Lead Eng." code...

    From hw driver CPP files:

    //buff is a mmaped shared mem
    //option is a std::string
    memset(buffer, ' ', buffer_len);
    
    switch(somebyte){
      case CONST1:
        option.assign("value1");
        break;
      case CONST2:
        option.assign("value2");
        break;
    //.....
    }
    
    memcpy(buffer, option.c_str(), option.length());
    

    End result: space terminated strings... :headdesk:



  • I put a null in my child's birth certificate and they recognized it as a space.



  • That's, uh...

    Maybe his first language was SQL?



  • You got us.

    We really wanted his first word to be MAMA, but he kept saying Selet.... Updah... Dwop.



  • @xaade said:

    We really wanted his first word to be MAMA, but he kept saying Selet.... Updah... Dwop.

    "Little Bobby Tables, we call him"?


  • Discourse touched me in a no-no place

    @presidentsdaughter said:

    "Senior Lead Eng."

    More like “Senile Lead Eng.” it seems.



  • @presidentsdaughter said:

    End result: space terminated strings... :headdesk:

    Quite normal if you want to pass it to Fortran code.

    Don't laugh. In the 2000s I spent five years in a company that still had tens of millions of lines of Fortran, and a policy of trying to get rid of it and prevent new Fortran code from being written(1), but:

    • You still had to deal with its existence.
    • There was no shortage of developers who worked hard to subvert the no-new-Fortran rules.

    (1) This went as far as adding a commit trigger that blocked commits that created new .f files. People just added their new Fortran functions to nearby existing .f files. Adding a rule that prevented new functions being created in existing files would, I suspect, have resulted in people using the ENTRY statement to embed the code of their new functions in existing functions.


Log in to reply
 

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