Ugly syntax

This is a discussion on Ugly syntax within the C++ Programming forums, part of the General Programming Boards category; Am I the only one that thinks that the C++ syntax is ugly when you are getting more advanced?. If ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    591

    Ugly syntax

    Am I the only one that thinks that the C++ syntax is ugly when you are getting more advanced?. If you just use simple classes no stl and use a workflow similar to C it looks really crisp and is easy to read. But when I add muliple inheritance. maps and pointers I think it is flat out ugly to read. I know some of it is my lack of deeper knowledge. What do you guys think?. What if you compare to C# that isn't as advanced or power full but it always sems to stay clean and easy to read.

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    you're asking opinion. my opinion is no. Sloppy code is ugly, not C++. I've seen much uglier code written in C than I have in C++. Weither it be because of macros, globals, gotos, externs whatever, C is NASTY. Multiple inheritance is not bad. Poor use of it is. ActiveX/COM is ALL using multiple inheritance for its interfaces. There is nothing wrong with that.

    pointers? you think pointers are hard to deal with? how is that different than C?
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    And the error messages get worse too.

    This is an error message I had in MSVC++.NET when I made the simple mistake to try to push a A* to a vector that contained A.

    http://strandmark.com/prog_fel.gif
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #4
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    well alternatively you could turn to COBOL or BASIC

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    591
    Don't get me wrong. I wouldn't trade C++ for anything. I don't have a problem with pointers it's just that when you mix all the powerfull C++ components together I think it gets really cumbersome to both read and type. I know the reason C++ is harder then anything else is that it is more powerfull then anything else but I often get the feeling that the code syntax is just blocks randomly stacked ontop of eachother. This is of course due to the history of C++ and compability requerments with C and the latest .NET add on? Use Cobol or Basic?? Get real!!

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    I agree that on first glance a section of C++ code with templates, typedefs and inheritance everywhere can look a total eyesore....

    Dean posted a section of code on Flashdaddee and was complaining about how the typedefs make the language look bad.....had to agree...on first glance it looked nasty

    I suppose though that once you have a basic idea of what a section of code is trying to achieve, it makes reading it easier.......

  7. #7
    Registered User
    Join Date
    Feb 2002
    Posts
    591
    I agree with you there Fordy. Once you figured out what it is supposed to do it all make sense, and no other syntax would make sense. I guess it looks complicated just because it is. I read something that Bjarne wrote as a replay to a similar question and his point was that if Java, C,C#, Basic,,etc was as advanced as C++ those languishes(sp) would be hard to read to.

  8. #8
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    are typedefs not a C feature?
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  9. #9
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    If you read stroustrups book most of the code looks clean.
    I guess otherwise no one would use
    c++.

    You can do little things like typedef your iterators and if
    you think a variable is too long you can always create
    a referance to it. I like Upper and then lower case typedef.
    So I would do
    typedef int Int_32. Most people do
    typedef int INT_32 but I think that shouts out too
    much to the reader. hungarian notation looks
    ugly. But using little
    of hungarian notation such as p, m_ or n looks ok in some
    places. Then again hungarian notation is ugly.

    template code is really harder
    to read/write. I think most people write it using something like int and then go over and change it to use templates.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 09:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21