• x4740N@lemmy.world
    link
    fedilink
    English
    arrow-up
    96
    arrow-down
    1
    ·
    6 months ago

    Wouldn’t most development programs tell them the syntax error on the line and column where you replaced the semicolon

    This wouldn’t work

  • Brickardo@feddit.nl
    link
    fedilink
    arrow-up
    71
    ·
    6 months ago

    Why, of all possible languages, would you suggest this for Javascript where semicolons are not mandatory

    • ulkesh@beehaw.org
      link
      fedilink
      English
      arrow-up
      22
      ·
      6 months ago

      Not only that, the interpreter will point directly to the line of code and possibly to the exact character that is the problem. Any programmer worth anything would find the issue or, worst case, retype the line of code and have the problem fixed rather quickly. “Illegal character” is a pretty easy error to diagnose.

      But…I still chuckled a little at the intent of the joke. I’m sure there are better pranks one could come up with, though.

  • phorq@lemmy.ml
    link
    fedilink
    Español
    arrow-up
    53
    ·
    6 months ago

    Even better would be to remap their keyboard’s semicolon key to that symbol

  • Passerby6497@lemmy.world
    link
    fedilink
    English
    arrow-up
    29
    ·
    6 months ago

    Meanwhile in VS Code: hey, I see this Unicode symbol that’s confused for this expected symbol, would you like to replace it?

    • whotookkarl@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      6 months ago

      BOM U+FEFF is another fun one, most editors won’t show it but it can cause errors like when I found one in a SQL script that was combined from existing utf-8 files together with cat. You’ll see it in a hex editor or in notepad I think it just made the rest of the line italic.

  • fubarx@lemmy.ml
    link
    fedilink
    arrow-up
    19
    ·
    6 months ago

    MSVC supports unicode. In C or C++, you could try:

    #define ; ;

    Second one is the greek semicolon but the client I’m using may strip it out. I’m too lazy to try.

    • PM_ME_VINTAGE_30S [he/him]@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      3
      ·
      6 months ago

      Running #define ; anything yields error: macro names must be identifiers for both C and C++ in an online compiler. So I don’t think the compiler will let you redefine the semicolon.

      • fubarx@lemmy.ml
        link
        fedilink
        arrow-up
        3
        ·
        6 months ago

        Haha. Thanks for checking. Given the C pre-processor, I’m sure there’s a way to maliciously bork it if someone sets their mind to it.

        • PM_ME_VINTAGE_30S [he/him]@lemmy.sdf.org
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          6 months ago

          Well I just tried #define int void in C and C++ before a “hello world” program. C++ catches it because main() has to be an int, but C doesn’t care. I think it is because C just treats main() as an int by default; older books on C don’t even include the “int” part of “int main()” because it’s not strictly necessary.

          #define int void replaces all ints with type void, which is typically used to write functions with no return value.

    • Sailing7@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      6 months ago

      I’m not sure but I think the second one looks just a tiny bit different, so it should have worked.

  • dlok@lemmy.world
    link
    fedilink
    arrow-up
    12
    ·
    6 months ago

    Wanted to use this to prank a colleague but SQL server accepts that as well lol

    • Zerush@lemmy.mlOP
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      6 months ago

      What? Remapping your keyboard? Well, there are worst jokes, I still remember that time when the first PCs appeared and you could try them in shopping centers. They quickly stopped doing this, because some went into the BIOS and disabled the keyboard or worse, the screen, Hail Satan. Good ol’ times 😏