• Jay K. (unregistered)

    TRWTF is that everything defined in the meta-class is public, right?

  • Anonymous Coward (unregistered)

    And this is why so many people hate C++. Because some idiot shoots himself in the foot.

  • Vacaloca (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.

    #define SHOOT_SELF_IN_FOOT(cout << "C++";)

  • Warren (unregistered) in reply to Vacaloca
    Vacaloca:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.

    #define SHOOT_SELF_IN_FOOT(cout << "C++";)

    You need to define an easy-to-read version of cout, << and "C++"

  • (cs)

    I particularly like the way that TAG_DEFINE_INTERFACE declares a class without defining it.

    This is the result of someone trying to find a clever way to prevent people from creating mixed interface/implementation classes. That is, accidentally (or otherwise) adding a non-purevirtual function, or, godforbid, a variable to an interface class.

    The intelligent way (note that there is a big difference between intelligent and clever!) is called a code review, but to be effective it requires people to be intelligent about how they review things. In the absence of that, the sole virtue of this is that it makes it more obvious to a reviewer that you have broken the rules of the game - a "correctly" defined interface consists entirely of TAG_... macro invokations (and some comments, I'd hope).

    The correct solution, of course, is to hire better quality developers, but that will never catch on.

  • (cs) in reply to Anonymous Coward
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    No, it is because in the process he manages to shoot us in the foot as well. I don't hate C++, but I do recognise that in the hands of our differently-abled colleagues it is a very dangerous tool, nay, a weapon of monstrous destructive power.
  • Oxyd (unregistered)

    Consistent and fairly simple syntax for classes and members, you say?

    #include <iostream>
    
    void typedef fun() const;
    volatile typedef int const var;
    
    const struct {
      fun f;
      var v;
    } typedef foo;
    
    void foo::f() const {
      std::cout << v << '\n';
    }
    
    int main() {
      foo f = { 42 };
      f.f();
    }

    Look, ma, no macros!

  • tg (unregistered)

    Reminds me of how the Microsoft Foundation Classes implemented message handling declarations... ;-)

  • (cs)

    You're talking about VC++, which though like C++ is also different from C++.

  • frits (unregistered)
    TAG_BEGIN_INTERFACE(MyInterface)
    	TAG_DECLARE_SET_GET_FUNCTION(int, foo)
    	TAG_DECLARE_SET_GET_FUNCTION(int, bar)
    TAG_END_INTERFACE()
    

    Who wouldn't want to write code like this?

  • Ha! (unregistered)

    TRWTF is not knowing how to run a preprocessor so that it only processes a certain subset of defined macros.

    Oh wait. "Visual Studio". Of course "David Kaye" wouldn't know how to do that.

  • Nick (unregistered) in reply to Anonymous Coward

    Not really. This is why so many people hate idiots claiming to be programmers and having absolutely no clue what they are doing

  • Tim (unregistered)

    it reminds me of working for Cap/Sema Group in the 80's - they had a set of C macros called SPO (structured programming option) that tried to turn C into fortran something like this:

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

    etc etc.

  • JohnO (unregistered)

    Or a Pascal programmer transitioning to C but can't quite let go

    #define BEGIN { #define END }

  • (cs) in reply to Anonymous Coward
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    It's why any language can be considered a WTF really.... how many times here have we heard "TRWTF is php/VB/Java" etc.? The root cause is always the same - bad programmers, not bad languages.
  • Sobriquet (unregistered)

    C++ has simple syntax for classes, huh?

    Hard to troll a site when the editors beat you to it.

    But since the original designers decided to #define a meta-language in C++, and then use that meta-language to represent all of the key classes, his knowledge hardly came in handy.

    Too bad his knowledge didn't include commenting out other includes and running his source through the preprocessor to strip out the stupid TAG_ stuff.

  • RCX (unregistered)

    That WTF can be fixed with sed easily if you have it and know how to use it. Or a multi-line replace field in a search replace dialog box, if there is such a thing...

  • (cs) in reply to Nick
    Nick:
    Not really. This is why so many people hate idiots claiming to be programmers and having absolutely no clue what they are doing

    Any chance, that you work at my client location in Califirona?

  • Anonymous (unregistered) in reply to Sudo
    Sudo:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    It's why any language can be considered a WTF really.... how many times here have we heard "TRWTF is php/VB/Java" etc.? The root cause is always the same - bad programmers, not bad languages.
    Funny, though, recurrence follows a bell curve distribution...with VB at the apex and Java near the bottom. This is especially important, seeing at Java makes up 75% of software development being done today but less than 10% of the wtfs.
  • Sobriquet (unregistered) in reply to Sudo
    Sudo:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    It's why any language can be considered a WTF really.... how many times here have we heard "TRWTF is php/VB/Java" etc.? The root cause is always the same - bad programmers, not bad languages.

    No, languages like PHP and VB really do suck. People consistently write shit in them because they lend themselves to copypasta programming. If it weren't for those languages, the mass of those idiots wouldn't be programming at all.

    The systems languages like Java and C++ require a certain amount of discipline to use, so while there are bad programmers, there are an order of magnitude fewer than with VB and PHP.

    Even when I do see a C++ programmer shoot himself in the foot, I can at least see, "oh, this guy was trying to do that, too bad it didn't work." In a typical VB WTF, there's absolutely no thought process whatsoever, because that's the language you choose when you just want to throw code together and bash away until it sort of works.

  • Anonymous (unregistered) in reply to Sudo
    Sudo:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    It's why any language can be considered a WTF really.... how many times here have we heard "TRWTF is php/VB/Java" etc.? The root cause is always the same - bad programmers, not bad languages.
    Ahhh, the classic "VB Defense". Sorry but you're not kidding anyone. The existence of crap developers does not preclude the existence of crap langauges. Languages like VB.

    But on-topic, C++ is an excellent example of what you were basically saying - that good langages can still be subverted by crap developers. Its main failing is giving the developer too much freedom but I don't see that as a bad thing, even if it does encourage the sort of rubbish in today's WTF.

  • An Old Hacker (unregistered) in reply to Sudo
    Sudo:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    It's why any language can be considered a WTF really.... how many times here have we heard "TRWTF is php/VB/Java" etc.? The root cause is always the same - bad programmers, not bad languages.

    A poor tool always blames its users.

    If you believe in bad code, then believe in bad architecture. If you believe in bad architecture, believe in bad languages, which, after all, are high-level specifications for compilers, interpreters, or whatnot.

    The map from how often a language gets uses verses how often it gets dumped on is ANYTHING but linear. Some languages really do suck more than others.

    What are "language smells"? How about... Trying to wrap one view of the world (say, OO) around another (say, procedural). This is a major problem for C++, java, and python. How about... Making a language so flexible that you practically force people to be cutesy, like perl? How about... Trying to address radically different problem spaces with a single solution, like php?

    Yes, the only languages that don't suck are the ones no one uses. That doesn't mean that the bad decision process which overflows the rest of human experience suddenly stops when people try to design a programming language.

  • EatenByAGrue (unregistered) in reply to Sobriquet
    Sobriquet:
    No, languages like PHP and VB really do suck. People consistently write shit in them because they lend themselves to copypasta programming.

    Hey, you leave His Noodlyness out of this!

    But seriously, PHP sucks for a lot of reasons, but one of the many reasons it sucks is because most of the community that's built up around it is one of web designers who think they're developers, not programmers who happen to write web applications. As a result, there are a lot of PHP folks out there who simply have no clue what makes code bad, only that it works and allows their site to look cook.

    A great web designer is a great thing to have, but they need to be designing websites, not developing code, and definitely not designing a language.

  • Anonymous (unregistered) in reply to Anonymous
    Anonymous:
    Sudo:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    It's why any language can be considered a WTF really.... how many times here have we heard "TRWTF is php/VB/Java" etc.? The root cause is always the same - bad programmers, not bad languages.
    Ahhh, the classic "VB Defense". Sorry but you're not kidding anyone. The existence of crap developers does not preclude the existence of crap langauges. Languages like VB.

    But on-topic, C++ is an excellent example of what you were basically saying - that good langages can still be subverted by crap developers. Its main failing is giving the developer too much freedom but I don't see that as a bad thing, even if it does encourage the sort of rubbish in today's WTF.

    In C++'s defence, one of the reasons for its longevity is its ability to conform to be all for all. ANY language which imposes limits will by necessity be limited in its usefulness.

    Here's where I think there's something to be said for polyglot: use languages designed for a single purpose which follow standard conventions to solve specific problems. What I see too much of these days is J2EE-mindedness where we will try to build one system that will do EVERYTHING. Someone takes an open-source project for viewing pictures and try to integrate text-messaging into it.

    Now I know that polyglot comes with its own set of WTFs, one of which is evident here in that people try to take the language and make it do something they've always done in another language and make it work the same way.

  • Gigaplex (unregistered)

    As someone who works with MFC, COM and ATL on a daily basis (I didn't say I enjoyed it), this seems fairly tame. Message maps, STDMETHODs and other preprocessor goodness really confuse the hell out of step-into debugging...

  • C-Octothorpe (unregistered) in reply to Anonymous
    Anonymous:
    Sudo:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    It's why any language can be considered a WTF really.... how many times here have we heard "TRWTF is php/VB/Java" etc.? The root cause is always the same - bad programmers, not bad languages.
    Funny, though, recurrence follows a bell curve distribution...with VB at the apex and Java near the bottom. This is especially important, seeing at Java makes up 75% of software development being done today but less than 10% of the wtfs.

    Christ on a bike man, that must have hurt pulling numbers like that out of your ass...

    OR, it's that the level of most java devs is so low that one shitty programmer can't tell that another shitty programmers code is, well, shit.

  • (cs)

    How do you define a class in C++ again? Keyword "class", the class name, and a left curly-brace you say? Then you end with a right curly-brace and a semicolon? I'll never remember that. I'll just use the #defined meta-language. It's like writing code in a spoken language.

    Yep, good old BEGIN_TAG_INTERFACE and END_TAG_INTERFACE, etc.; there's no way I can mess up using them.

  • (cs) in reply to Steve The Cynic
    Steve The Cynic:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    No, it is because in the process he manages to shoot us in the foot as well. I don't hate C++, but I do recognise that in the hands of our differently-abled colleagues it is a very dangerous tool, nay, a weapon of monstrous destructive power.
    I would suggest this is the case of any programming language in the hands of a creative idiot. Some "programmers" can always find a way to construct a total disaster, regardless of the tools they use.
  • Vacaloca (unregistered) in reply to Anonymous
    Anonymous:
    Sudo:
    Anonymous Coward:
    And this is why so many people hate C++. Because some idiot shoots himself in the foot.
    It's why any language can be considered a WTF really.... how many times here have we heard "TRWTF is php/VB/Java" etc.? The root cause is always the same - bad programmers, not bad languages.
    Funny, though, recurrence follows a bell curve distribution...with VB at the apex and Java near the bottom. This is especially important, seeing at Java makes up 75% of software development being done today but less than 10% of the wtfs.

    Or Java is too enterprisey for concise entries in a blog post. Nobody wants to read a 1500 line WTF.

  • Stephen Cleary (unregistered) in reply to An Old Hacker
    An Old Hacker:
    What are "language smells"? How about... Trying to wrap one view of the world (say, OO) around another (say, procedural). This is a major problem for C++, java, and python.

    I agree with Java, but not C++ and Python. Both C++ and Python have good support for procedural solutions; they both strive to be multi-paradign languages. Python also has good support for functional solutions (and C++ is in the process of getting more functional support).

    As an old C++ programmer (who has done a lot of OO, procedural, and generative), I must say the C# language annoys me greatly. Entirely OO with a bit of procedural and functional support, and no generative support at all...

  • (cs) in reply to EatenByAGrue
    (snip) Hey, you leave His Noodlyness out of this!

    But seriously, PHP sucks for a lot of reasons, but one of the many reasons it sucks is because most of the community that's built up around it is one of web designers who think they're developers, not programmers who happen to write web applications. As a result, there are a lot of PHP folks out there who simply have no clue what makes code bad, only that it works and allows their site to look cook. (snip)

    pastifarian slip?

  • (cs)

    Fact #1: I love to program in C++.

    Fact #2: I hate when other people program in C++.

  • Machtyn (unregistered)

    I think the hiring of better, quality programmers (or employees in general) is usually purely by accident. I could be wrong.

  • rfoxmich (unregistered)

    TRWTF is that I'd have to actually hand code the class if I inherited from more than two other classes ;-)

  • The Corrector (unregistered) in reply to frits
    frits:
    Fact #1: I love to program in VB

    Fact #2: I hate when other people program in C++.

    FTFY
  • airdrik (unregistered) in reply to rfoxmich
    rfoxmich:
    TRWTF is that I'd have to actually hand code the class if I inherited from more than two other classes ;-)
    Yeah - TRWTF is that they have a macro for a class which inherits from two parents but no support for inheriting from N parents.
  • The Corrector (unregistered) in reply to rfoxmich
    rfoxmich:
    TRWTF is that I'd have to actually hand code the class if I inherited from more than two other classes ;-)
    No, two is sufficient. If you want to implement 3, for example, simply create a new interface which implements two of them and derive from that interface as well as the third. You can do this ad infinitum.

    QED by induction.

  • Rajesh Midde Kumar Kukanoor (unregistered) in reply to The Corrector
    The Corrector:
    rfoxmich:
    TRWTF is that I'd have to actually hand code the class if I inherited from more than two other classes ;-)
    No, two is sufficient. If you want to implement 3, for example, simply create a new interface which implements two of them and derive from that interface as well as the third. You can do this ad infinitum.

    QED by induction.

    Way to get trolled, "The Corrector".

  • airdrik (unregistered) in reply to Stephen Cleary
    Stephen Cleary:
    An Old Hacker:
    What are "language smells"? How about... Trying to wrap one view of the world (say, OO) around another (say, procedural). This is a major problem for C++, java, and python.

    I agree with Java, but not C++ and Python. Both C++ and Python have good support for procedural solutions; they both strive to be multi-paradign languages. Python also has good support for functional solutions (and C++ is in the process of getting more functional support).

    As an old C++ programmer (who has done a lot of OO, procedural, and generative), I must say the C# language annoys me greatly. Entirely OO with a bit of procedural and functional support, and no generative support at all...

    Except that C++ is C (a procedural language) with OO retro-fitted on top of it, which is An Old Hacker's point. So, really it is only C++ (and VB, and php) that fits his description. Java (and c#) is pure OO from the get-go, with its own set of language smells. Python very neatly mixes OO with procedural and functional programming and comes with its own language smells.

    Of course generative support (macros) is a language smell in-and-of itself: It is an attempt to fix flaws in the language by allowing you to create rules for rewriting your code before compiling. If the language needs it then there is something wrong with the language. A couple of the big WTF's I've seen around Python were when I found that someone had implemented goto for python (April fool's joke, thankfully), and when someone implemented a preprocessor for it. If you think you need it, you are wrong and need to go back and study the language some more.

  • English Man (unregistered) in reply to Gigaplex
    Gigaplex:
    As someone who works with MFC, COM and ATL on a daily basis (I didn't say I enjoyed it), this seems fairly tame. Message maps, STDMETHODs and other preprocessor goodness really confuse the hell out of step-into debugging...
    Yes but they exist for a reason, adding extra stuff you'd hate to have to type every time, not just to avoid using using classes properly.

    And...

    • VB doesn't intrinsically suck. Not VB.net at least.
    • PHP doesn't intrinsically suck, newer versions anyway
    • VC++ is the best C++ tool available, especially with VAX
  • (cs)

    "Oh my God!" </HankHill>

  • Jellineck (unregistered) in reply to English Man

    "VB doesn't intrinsically suck. Not VB.net at least. "

    Please stop attempting to conflate VB and VB.net. They are two entirely different languages.

    The biggest problem I've seen in this industry is people thinking that the only difference between VB and VB.net is ".net". The end result is always mountains of WTF.

    Your comment is equivalent to saying "Paschal doesn't intrinsically suck. Not Fortran at least."

  • (cs)

    This smells of java programmers trying to program in C++.

  • C-Octothorpe (unregistered) in reply to Jellineck
    Jellineck:
    "VB doesn't intrinsically suck. Not VB.net at least. "

    Please stop attempting to conflate VB and VB.net. They are two entirely different languages.

    The biggest problem I've seen in this industry is people thinking that the only difference between VB and VB.net is ".net". The end result is always mountains of WTF.

    Your comment is equivalent to saying "Paschal doesn't intrinsically suck. Not Fortran at least."

    And now you're going to try to tell me that Java and JavaScript are two different things? Pa-LEASE!

  • Anonymous (unregistered) in reply to Jellineck
    Jellineck:
    "VB doesn't intrinsically suck. Not VB.net at least. "

    Please stop attempting to conflate VB and VB.net. They are two entirely different languages.

    Seconded, that's really annoying. It's easy to do (thanks for that Microsoft) but to avoid confusion I'm always very careful to specify "VB" or "VB.NET". VB != VB.NET.

    Don't get me wrong, they both suck donkey balls thanks to the crappy syntax, but they are worlds apart.

  • 4VAlien (unregistered)

    Nothing that some regexps can't fix?

  • Jules Winnfield (unregistered) in reply to delta534
    delta534:
    This smells of java programmers trying to program in C++.

    Preprocessor #define statements! The cornerstone of every Java program.

  • (cs)

    Why stop there?

    #define TAG_ADD(a,b) ((a) + (b)) #define TAG_SUB(a,b) ((a) - (b)) #define TAG_MUL(a,b) ((a) * (b)) #define TAG_DIV(a,b) ((a) / (b)) #define TAG_EXP(a,b) ((a) **(b)) #define TAG_TRUE 0 #define TAG_FALSE 1 #define TAG_FNF() FILE_NOT_FOUND // etc

  • blah (unregistered)
    It's worth pointing out that using these macros broke Visual Studio's "Go To Declaration/Definition" function, which is also useful when one is trying to get to grips with the code.
    As if. One sneeze and the stupid thing stops working. Microsoft has long neglected the people who make real software.
  • C-Octothorpe (unregistered) in reply to snoofle
    snoofle:
    Why stop there?

    #define TAG_ADD(a,b) ((a) + (b)) #define TAG_SUB(a,b) ((a) - (b)) #define TAG_MUL(a,b) ((a) * (b)) #define TAG_DIV(a,b) ((a) / (b)) #define TAG_EXP(a,b) ((a) **(b)) #define TAG_TRUE 0 #define TAG_FALSE 1 #define TAG_FNF() FILE_NOT_FOUND // etc

    . . .

    #define TAG_ONE 1 #define TAG_TWO 2

    ...

    #define TAG_TEN 10 #define TAG_ELEVEN 13 // 11 // SG: as per defect #43562

Leave a comment on “TAG++”

Log In or post as a guest

Replying to comment #:

« Return to Article