• RobyMcAndrew (unregistered)

    I had a colleague who wrote macros for all the Turbo-C "color" functions, changing the names to use "colour". He just couldn't go on the American way.

  • PascalFan (unregistered)

    This would have been even better if he would have added

    #define begin { #define end }

  • MaxArt (unregistered)

    Mental sclerosis is a bitch.

  • Bogolese (unregistered) in reply to PascalFan


  • Griwes (unregistered)

    #define then

    Thanks for breaking my future, asshole.

  • Glenn (unregistered) in reply to PascalFan

    I actually had to work on a program where the developer did #define 'begin' and 'end'!!

  • xpil (unregistered) in reply to PascalFan

    #define if if (

    #define then )

  • Will Kirkby (github)

    I'm reminded somewhat of this classic WTF: http://thedailywtf.com/articles/0x23_include__0x22_pascal_0x2e_h_0x22

    Addendum 2016-08-09 07:25: ...So there should be an underscore immediately after "articles/", and again at the very end of the URL. Fantastic work there, TDWTF link parser.

  • The Serpent (unregistered)

    The C++ standards committee has told you a lie. You will not die if you break encapsulation. Instead, you will know the difference between good and evil. Want to eat from the tree of knowledge?

    At the top of every C++ source file you write:

    #define private public #define protected public

    Now you can use that free will for something useful.

  • (nodebb) in reply to Will Kirkby

    No, it's the [REDACTED] MarkDown-lite that nodebb uses, where wrapping a word in underscores makes it italic.

  • Bill (unregistered) in reply to PascalFan

    It's been done

  • (nodebb) in reply to The Serpent

    Shame all the internals of C++ classes change when you do this. (Seriously. You're sort of OK if this is only for your own objects, but if ever there is a library compiled without this linked with your program, and you have included its headers below such a thing in your C++ files that might use that library, and you run on a DeathStation 9000, well, so long Denver, it was nice knowing you. If there are two definitions of the same class(1) with (after the preprocessor has done its malevolent work) different token sequences(2), you are into the mysterious and unpredictable world of UB, undefined behaviour.)

    (1) glob::classname is not the same class as frobble::classname. (2) Including the notionally redundant insertion of private: immediately after the opening brace of a class.

  • (nodebb)

    Which reminds me that for someone who had to transition from BASIC to C, I had surprisingly little problems with variable declaration. Turns out it's because in the intervening years, I had used the TI-89 version of BASIC that required me to declare variables if I wanted them not to pollute the global namespace (where they would persist after program execution).

  • George Gonzalez (unregistered)

    Well, guess different strokes for different folks. I did do the horrible things like:

    #define IF if( #define THEN ) { #define ENDIF }

    A bit selfish of me, and would have been horrible for the next code peruser, but fortunately there wasn't one.

  • Belzebub (unregistered)

    in one quite large company I encountered internal rule, that every block in python (!) must be ended with appropriate #endif or #endfor.. so you could write "nice code like:

    if a == b: do_something() #endif

  • Carl Witthoft (google)

    Wot? Nobody wants to #define FRIST brillant ?

    Addendum 2016-08-09 10:44: wtf? "edit" means "no you can't edit, just add stuff? I wanted line breaks there!

  • I dunno LOL ¯\(°_o)/¯ (unregistered)

    In my college days (early '80s), mu uni was using PL/I as their official teaching language. In fact, my first semester was on a mainframe, where we logged into a system (called MUSIC) which ran as a single user under VM, and sometimes the system was frozen so hard with load from the other VMs that we couldn't even log off.

    The fun came when I would do my own personal coding, for early Mac OS. Having to write both Pascal and PL/I was a pain in the ass because they were pretty much backwards from each other in syntax.

  • Vilx- (unregistered)

    I was once in a similar position, just a year later - my own university year was the first one to use C++ after a decade or more of Pascal. Knowing both languages already resulted in me correcting the lecturer's syntax now and then. Awkward. :P

  • lonadar (unregistered)

    I remember taking Pascal in the starting CS 151 course when I entered college, and then Data Structures the following semester. At the time, much of the CS curriculum was Pascal based, with C being one of the courses you could take about the Junior level. Then, after a year, I sat out for about 2 years for various reasons and in the meantime the entire curriculum shifted to begin with C. I came back 2 years later a fish way out of water. Thankfully, the head of the CS department allowed me to sit in on his CS 151 without registering to learn C so I could get back in the track running - really enjoyed it.

  • DougB (unregistered) in reply to PascalFan

    When I started doing professional work in 1991 the company I worked for had a lead developer who used a file called "legible.h" that was full of macros to make C look like Turbo Pascal, including the "#define begin {" and "#define end }". Developers, who were hired based on the C skills weren't able to work on his code.

    Eventually he quit and we went through the code base and got rid of all of that weirdness.

  • TheCPUWizard (unregistered)

    #define then {} else

  • rdwells (unregistered) in reply to I dunno LOL ¯\(°_o)/¯

    MUSIC? Really? That was my first OS. My high school had a couple terminals hooked up to a Chicago Board of Ed. mainframe that ran MUSIC. I didn't know anyone else in the world used it, outside of McGill University.

    (For the unenlightened, MUSIC stood for "McGill University System for Interactive Communication". The "interactive" part was a bit of a stretch, though perhaps not by the standards of the time.)

  • Anonymous') OR 1=1; DROP TABLE wtf; -- (unregistered)

    Did the teacher from this story write the original Bourne shell? Yes, the following is real C code:

    LOCAL VOID      gsort(from,to)
            STRING          from[], to[];
            INT             k, m, n;
            REG INT         i, j;
            IF (n=to-from)<=1 THEN return FI
            FOR j=1; j<=n; j*=2 DONE
            FOR m=2*j-1; m/=2;
            DO  k=n-m;
                FOR j=0; j=0; i-=m
                    DO  REG STRING *fromi; fromi = &from[i];
                        IF cf(fromi[m],fromi[0])>0
                        THEN break;
                        ELSE STRING s; s=fromi[m]; fromi[m]=fromi[0]; fromi[0]=s;

    Source: http://research.swtch.com/shmacro

  • I dunno LOL ¯\(°_o)/¯ (unregistered)

    So anyhow, it only took me two tries to figure out roses and petals. Then I decoded the moderately obfuscated javascript (you're not going to understand it by doing "show source", that's for sure) to figure out wtf roots were. I now know what the roots number is, but I still have no clue as to what it represents. The wikipedia page is similarly uninformative about roots.

    As far as MUSIC goes, I think it was only being used for the intro classes, after that you got a proper IBM (CMS?) environment, with JCL and everything. (I had learned touch typing in high school, but thanks to those stupid 3270 terminals, I no longer use the right shift key.)

    They got a new VAX 780 in my second semester, and after fucking up my JCL by aligning it with extra spaces, I had to turn in my last second-semester projects on the VAX. For some reason the VAX PL/I had no "UNTIL" statement until a few years later, one of my first proper computer WTFs.

  • Anonymous') OR 1=1; DROP TABLE wtf; -- (unregistered)

    Well, the crappy forum software ate a lot of the code, so check the link instead.

  • (nodebb) in reply to RobyMcAndrew

    I had a colleague who wrote macros for all the Turbo-C "color" functions, changing the names to use "colour". He just couldn't go on the American way.

    I did that myself for windows.h from the Windows 3.0 SDK. I called the file with all the macros windows.uk; it was only 147 lines long, even though I covered "greyed" and "centre" as well.

  • what are roots? (unregistered) in reply to I dunno LOL ¯\(°_o)/¯

    I similarly don't know what roots are supposed to be. I can't figure out how the number of roots is related to the dice in any way. Any tips, anyone?

  • Konstantin Svist (github)

    The puzzle might have a bug in it I think the original idea is for the roots to be "blank spaces left to max value" because "roots are below ground and thus invisible" -- but the code subtracts from 7, not 6.. so the number of roots is too high.

    Or I didn't get the logic behind the pussle

    Addendum 2016-08-10 12:46: Figured it out

  • Ulysses (unregistered)

    No, Remy. Insertion and extraction operators were the cleanest true-to-C++ way to do formatted I/O before variadic templates.

  • Harrow (unregistered)

    Count me among those who processed Pascal to get C.

    However, I declined to confuse the heathen masses by using #define. Instead, I wrote a preprocessor to convert my Pascal *.pas files to intermediate C *.c files. That way, any subsequent maintainer could just throw away my *.pas file and begin to maintain the *.c file.

    Of course, as soon as someone modified the *.c file, he owned it.

  • _that_guy_ (unregistered) in reply to what are roots?

    The key to figuring out roots is to count all the places where dots might appear.

  • I dunno LOL ¯\(°_o)/¯ (unregistered)

    Also, the javascript thingy linked counts petals and roses, but it apparently isn't doing the proper "Petals Around the Rose" problem, which only gives an answer that is an even number greater or equal to zero.

    The only rules are you can be told the name of the puzzle, you can be told that the answer is an even number, and once you know it, you can't outright tell someone how it works. (And there are no roots involved.)

    Apparently the best story about it is from 1977, when Bill Gates was the slowest guy in the bunch to figure it out. According to the legend, he then wrote up some code on a napkin which had a line at the top reading:


    Yeah, maybe he didn't quite get it. (Then there was that time that he was on David Letterman and they made this big "Quiz Machine" thing for him. He didn't get that, either.)

  • Bytemaster (unregistered)

    1997 ending Pascal? Wow. In 1994 my High school was just STARTING to use Pascal at all, migrating away from BASIC. Then again, the only thing the Computer Science class had to work with was salvaged PCs. They didn't really invest in computing except for the administrators (a WTF for a different time).

    Now the same school district is 100% tablets for all students in all grades and entirely on Office 365.

  • FuuzyFoo (unregistered)

    Also went from Pascal to C++ (then later took a C class). I remember thinking about classes : "oh, it's a struct with code in it."

  • (nodebb)

    It took me a few tries, but I figured out the game, without "cheating" (google, open js, etc.). Roses were the easiest, but the petals and roots were a bit more difficult. After drawing a blank on a couple attempts, I did finally figure out the difference, and then verified it with a few more rolls.

  • Making it up (unregistered) in reply to Konstantin Svist

    Or I didn't get the logic behind the pussle

    Indeed. When you look at a plant such as a rose bush, where are the roots of the plant?

  • Pauller (unregistered)

    Thanks, Remy, for the fun puzzle. I figured petals and roses pretty easy, but got hung up on roots before finally figuring it out :)

  • mlpedant (unregistered) in reply to Vilx-

    Only awkward if you cared about the lecturer's feelings. In 1988 .. 1993 I didn't. (Still don't, but there are no lecturers relevant now.)

  • Jeff (unregistered) in reply to Konstantin Svist

    I also had a hard time with the roots until I remembered how dice are numbered. You almost have it.

  • Jeff (unregistered) in reply to what are roots?

    Think about what roots imply with respect to roses and think about what you can't see on the dice.

  • Artur Jaskulski (unregistered) in reply to rdwells

    Well, when I attended PUC-RS (Pontifical Catholic University of Rio Grande do Sul, Brazil) in 1986, they ran MUSIC in an IBM 4341. Definitely an horrible, laggy, awkward OS (OS? Wasn't it just a front-end?). Took ages to get something done.

  • Kiwi (unregistered) in reply to Jeff

    Thanks, your comment finally made me understand why roots are computed the way they are. I was not thinking 3D enough.

  • Ron Fox (google)

    I had a similar set of macros intended for physicists migrating from FORTRAN to C/C++:

    #define THEN { #define ENDIF }

    for example -- are much better macros.

    Addendum 2016-08-10 06:47: Darned forum

    #define THEN {
    #define ENDIF }
  • (nodebb) in reply to Kiwi
    • Spoiler (roses/petals/roots) *

    @Jeff and @Kiwi are exactly right. Thinking 3D is the way to get the roots. It works better with physical dice because you can turn them over and observe directly.

  • Konstantin Svist (github) in reply to Jeff

    Now I see why it's 7-n. Didn't remember that fun fact that about dice! But stupid thing is that I already considered that possibility before posting, but my arithmetic didn't work out for some reason facepalm

  • Andrew Dalke (unregistered)

    The book you should look at is "C as a second language : for native speakers of Pascal" from 1988. For example, page 87 includes the "#define THEN }", "#define IF if (", "#define BEGIN {", "#define END }", and "#define ELSE else" that others have mentioned here. It was the text book for my first C course.

  • Remy Porter (google) in reply to Konstantin Svist

    A standard die is called "transitive". Pick up any die and look carefully at the relationship between the sides of the die.

  • PMF (unregistered)

    Been there, done that...

    In 1998, when I signed up at ETH, you knew that C or C++ didn't exist there. There only existed Pascal (or variants of it, such as Oberon). So the introduction course was about Pascal, which was quite in my sense back then because I was already used to it and with Turbo Pascal it was really state of the art. That year, Niklaus Wirth (Google the name if you don't know) gave his retirement lecture... so the next year, it was C.

    The first assignment we got in C, I handed in Pascal code together with a macro file converting it to C. The assistant who reviewed it wasn't happy about that, but the code worked and I proved I could use the preprocessor...

  • (nodebb) in reply to I dunno LOL ¯\(°_o)/¯

    I had to read the source code in order to understand the puzzle...

  • (nodebb)

    It took me 2 rolls to get the roses/petals/roots. For roots, I had the correct hunch, but then I had to look up the relation of numbers on opposite faces to verify my hunch, since I couldn't turn the dice over to physically check.

Leave a comment on “Compatibly Backward”

Log In or post as a guest

Replying to comment #:

« Return to Article