Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

No matter how much you love a programming language, there are always a few details in it that aren’t quite as nice as they could be.

In this question, I would like to specifically focus on syntax elements. In a programming language that you use frequently (perhaps your favourite programming language, or perhaps the one you are forced to use at work), which syntax element do you find most unreadable, unclear, inconvenient or unpleasant?

share

locked by Yannis Rizos Oct 1 '13 at 10:37

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as not constructive by Morgan Herlocker, NickC, ChrisF May 26 '11 at 20:37

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

29  
Is "Java" an acceptable answer? –  Nathan Taylor Sep 3 '10 at 1:47

36 Answers 36

Whitespace Sensitivity.

Python annoys me in this respect. I mean, I indent properly anyway, but it bugs me that I should have to. Making presentation part of the syntax irks me.

share
8  
you'll learn to love it –  user10008 Aug 18 '11 at 4:59
2  
syntax is presentation –  Winston Ewert Jan 3 '12 at 3:41

\we\wouldnt\fix\our\parser namespace syntax in PHP

The syntax is not only ugly, it leads to confusion when newer developers have to think about namespaces in strings. (PHP interpolates backslashes in double-quoted strings as escape sequences. Trying to represent a namespace like \you\should\never\do\that in a double-quoted string instead of a single-quoted string will lead to newlines, tabs and disaster.)

share

SSIS - SQl Server I hate everything about the Expression Builder. I already know how to write these types of conditions in t-sql. Why can't they Expression builder use the same syntax t-SQl would use (especially The equivalent to the CASE statement)? Or let me write t-sql statements instead of creating stupid wierd expressions. And why am I stuck doing complex conditions in a form that only allows me to use one line so I am in scroll bar hell?

share

I know this is an older question, but how come no one mentioned.

CODE NUGGETS

<% %> <-- Regular

<%= %> <-- Buffalo style

<%:%> <-- extra crispy

share

EDIT: Following the discussion in the comments I decided to update this answer to explain myself better.

I really hate the way function pointers look in C. Usually any variable declaration looks like a tuple of: type varname; Function pointer declarations on the other hand look like a declaration of the function with * before the function name. I can accept this as a description of a pointer type, but in C this declares both the type and the name of a variable of that type. This looks inconsistent to me because type declarations are otherwise distinct from variable declarations. struct myStruct{int X; int Y;} only defines a type, it does not define a variable named myStruct. Likewise I see no reason for type declarations and variable declarations to be grouped into one atomic statement in function pointers, nor do I appreciate the deviation from the type varname; structure.

Someone pointed out that it's consistent with some spiral rule, and that may be the case, but the mark of a good syntax is that it is self explanatory and its internal logic is obvious. The spiral rule is not obvious by any means.

share
1  
It's consistent with the rest of the language, so maybe your gripe is about the syntax of C declarators in general? Do you prefer the syntax used in Go? –  finnw Sep 3 '10 at 5:10
4  
@EpsilonVector: I tend to agree that function pointer syntax is nasty, but there is a simple rule to follow that makes it easier to read. The clockwise spiral rule (perhaps you've seen it?): c-faq.com/decl/spiral.anderson.html –  greyfade Sep 4 '10 at 20:57
1  
EpsilonVector: I'm not sure what you'd expect from a pointer variable declaration to declare other than the name of the variable. –  Roger Pate Sep 9 '10 at 3:29

Java-bean syntax due to lack of C# properties

/**
 * Name of user
 */
private String name;

/**
 * Gets name of user
 * @return Name of user
 */
public String getName() {
    return this.name;
}

/**
 * Sets name of user. 
 * @param name
 */
public void setName(final String name) {
    this.name = name;
}

GAH!!!

Issues I have with this

  • Too much code - Have a field that's documented, a getter method that's documented, and a setter method that's documented. This extremely basic example has 20 lines of code for a single property
  • Clutters method lists - "Let me find that method, hand on: getX, getY, getZ, getAnotherAnnoyingField, getWhyIHateJavaBeans, getThisIsVerbose, getGAH... ah there it is, hashCode.
  • Multiple area's of documentation lead to poor, outdated, or missing documentation - Annoying when trying to understand what code does
  • So annoying a 3rd party had to come up with a plugin to do this easily - Spoon, Shark, among others.
share
9  
Once again when code is so verbose that it needs auto generating tools, something is wrong. I'm a NetBeans guy, but it also has the ability to auto generate getters and setters. But Javadoc falls out of syn, it's still verbose, it still clutters javadoc, etc –  TheLQ Sep 4 '10 at 19:13
11  
If you need getters for everything then something is wrong with the client code. –  finnw Sep 10 '10 at 19:51
7  
Having getters and setters breaks encapsulation. The field might as well be public. Members should be private and should be manipulated sensibly by the class with higher-level logic, not with getters and setters from client code. –  greyfade Sep 18 '10 at 5:54
6  
@greyfade: If it's public, you can't easily change what the setting code does (you'll have to change all code that sets the field from the outside). –  Bart van Heukelom Sep 18 '10 at 10:41
3  
@SHiNKiROU: Java looks clean? I've never heard that one before! My main gripe with Java is the fact that seemingly simple thing takes dozens of lines of code I need to mentally ignore. –  configurator Sep 29 '10 at 6:31

Ternary statements. They are generally much harder to read yet only save a few lines of code.

if (myCondition) {
    return firstAlternative();
}
return secondAlternative();

versus

return myCondition ? firstAlternative() : secondAlternative();
share
1  
Ergh. If you are going to write it longhand, at least use an else. –  Tom Hawtin - tackline Feb 27 '11 at 14:28
4  
Your example saves 3 out of 4 lines of code, i.e. 75%. This means that significantly more code will fit on my screen at a time. I think that is a pretty clear benefit. If you find statements involving the conditional operator “harder to read”, you probably just need to train yourself a bit more, and then you’ll have no trouble with them :) –  Timwi Feb 27 '11 at 16:16
1  
In addition, there is no such thing as a "ternary statement". It's an expression and he who doesn't recognize the difference should go look for another job. –  Ingo Sep 6 '11 at 11:32

REGEX / preg_match() in PHP

Firstly, its completely different syntax than PHP uses. While the preg_match() function emulates regex quite excellently, I have to completely switch my mode of thinking to work with it.

Secondly, its just plain obscurification half the time. I usually have to quite literally take out a scratch pad and figure out WTF its doing half the time.

Besides, I program in PHP, not Perl. If I liked Perl, I would program in Perl. (no, sir I don't like it.)

To make matters worse, with the new PCRE delimiter format, you can practically use any character, which includes having to escape that same nested character, making the pattern even more obscure.

Sure, its great if you want to be cryptic.. or even efficient... but holy hell the amount of time it wastes to normally perform simple tasks.

share
5  
The fact that you have your answer written with PERL in all caps tells me that you've never actually looked into the language at all and don't know anything about it. –  Daenyth Sep 17 '10 at 19:06

$this->... in PHP ... unnecessary, looks bad and considerably slows down "quick-grasp-on-short-glance" (my closed thread on SOF).

share
1  
as optional is useful, as mandatory is unnecesary... –  umlcat Mar 15 '11 at 21:23

Verbosity in Java anonymous classes. Will hopefully be fixed soon.

share

Java

Period. Full stop. End of story.

Where to start? Oh, I know where to start: Java’s insanely complicated and ugly and stupid and inherently broken generics. Need I say more? :( Ok fine, then: type erasure.

Then there’s non-deterministic resource management. Kewl feetcher!

What’s next up? Oh yeah: Java’s stupid regexes are my most irritating, seething beef. I cannot count how many times I’ve been hosed by not having enough backslashes. This is even worse than not having access to any Unicode properties from this millennium — which is complete bull. Ten fricking years out of date!!! Completely useless. Trash it.

Then there’s the bug that the character class shortcuts don’t work on non-ASCII. What a royal pain! And don’t even consider using \p{javaWhiteSpace}; it doesn’t do the right thing with several very common Unicode whitespace code points.

Did you know there’s a \p{javaJavaIdentifierStart} property? Whatwhatatat wereere they thinkinking? So glad they got such smart peepers wurkin on dis tough.

Ever tried to use the CANON_EQ flag? Do you know that really does, and what it doesn’t do? How about so-called “Unicode case”? A bunch of normal casing things just don’t work at all.

Then they make it hard to write maintainable regexes. Java still hasn’t figured out how to write multiline strings, so you end up writing insane things like this:

    "(?= ^ [A-Z] [A-Za-z0-9\\-] + $)      \n"
  + "(?! ^ .*                             \n"
  + "    (?: ^     \\d+      $            \n"
  + "      | ^ [A-Z] - [A-Z] $            \n"
  + "      | Invitrogen                   \n"
  + "      | Clontech                     \n"
  + "      | L-L-X-X                      \n"
  + "      | Sarstedt                     \n"
  + "      | Roche                        \n"
  + "      | Beckman                      \n"
  + "      | Bayer                        \n"
  + "    )      # end alternatives        \n"
  + ")          # end negated lookahead   \n" 

What are all those newlines? Oh, just Java stupidity. They used Perl comments, not Java comments (idiots!) which go till end of line. So if you don’t put those \n’s there, you chop off the rest of your pattern. Duh and double duh!

Don’t use regexes in Java: you’ll just end up wanting to smash things, it’s all so painful and broken. I can’t believe people put up with this. Some don’t.

Then we can start talking about Java’s idiot nonsense with encodings. First, there’s the fact that the default platform encoding is always some lame 8-bit encoding even though Java’s charchars are Unicode. Then there’s how they don’t raise an exception on an encoding error. You’re guaranteed to get crap. Or how about this:

OutputStreamWriter(OutputStream out) 
          Creates an OutputStreamWriter that uses the default character encoding.
OutputStreamWriter(OutputStream out, Charset cs) 
          Creates an OutputStreamWriter that uses the given charset.
OutputStreamWriter(OutputStream out, CharsetEncoder enc) 
          Creates an OutputStreamWriter that uses the given charset encoder.
OutputStreamWriter(OutputStream out, String charsetName) 
          Creates an OutputStreamWriter that uses the named charset.

What’s the difference? Did you know that only one of those will raise an exception if you have an encoding error? The rest just muzzle them.

Then there’s the idiocy of Java chars not being sufficient to hold a character! What the hell are they thinking? That’s why I call them charchars. You have to write code like this if you expect it work right:

private static void say_physical(String s) { 
    System.out.print("U+");
    for (int i = 0; i < s.length(); i++) {
        System.out.printf("%X", s.codePointAt(i));
        if (s.codePointAt(i) > Character.MAX_VALUE) { i++; }  // UG!
        if (i+1 < s.length()) { System.out.printf("."); }
    }
}

And who ever thinks to do that? Next to nobody.

How many characters are there in "\uD83D\uDCA9"? One or two? Depends on how you count them. The regex engine of course deals with logical characters, so a pattern ^.$ will succeed and a pattern ^..$ will fail. This insanity is demonstrated here:

String { U+61, "\u0061", "a" }  =~ /^.$/ => matched.
String { U+61, "\u0061", "a" }  =~ /^..$/ => failed.
String { U+61.61, "\u0061\u0061", "aa" }  =~ /^.$/ => failed.
String { U+61.61, "\u0061\u0061", "aa" }  =~ /^..$/ => matched.
String { U+DF, "\u00DF", "ß" }  =~ /^.$/ => matched.
String { U+DF, "\u00DF", "ß" }  =~ /^..$/ => failed.
String { U+DF.DF, "\u00DF\u00DF", "ßß" }  =~ /^.$/ => failed.
String { U+DF.DF, "\u00DF\u00DF", "ßß" }  =~ /^..$/ => matched.
String { U+3C3, "\u03C3", "σ" }  =~ /^.$/ => matched.
String { U+3C3, "\u03C3", "σ" }  =~ /^..$/ => failed.
String { U+3C3.3C3, "\u03C3\u03C3", "σσ" }  =~ /^.$/ => failed.
String { U+3C3.3C3, "\u03C3\u03C3", "σσ" }  =~ /^..$/ => matched.
String { U+1F4A9, "\uD83D\uDCA9", "💩" }  =~ /^.$/ => matched.
String { U+1F4A9, "\uD83D\uDCA9", "💩" }  =~ /^..$/ => failed.
String { U+1F4A9.1F4A9, "\uD83D\uDCA9\uD83D\uDCA9", "💩💩" }  =~ /^.$/ => failed.
String { U+1F4A9.1F4A9, "\uD83D\uDCA9\uD83D\uDCA9", "💩💩" }  =~ /^..$/ => matched.

That idiocy is all because you can’t write the perfectly reasonable \u1F4A9, nor of course do you get any warning that you can’t do that. It just does the wrong thing.

Stoooopid.

While we’re at it, the whole \uXXXX notation is congenitally brain dead. The Java preprocessor (yes, you heard me) gets at it before Java does, so you are forbidden from writing perfectly reasonable things like "\u0022", because by the time Java sees that, its preprocessor has turned it into """, so you lose. Oh wait, not if it’s in a regex! So you can use "\\u0022" just fine.

Riiiiiiiight!

Did you know there’s no way in Java to do an isatty(0) call? You aren’t even allowed to think such thoughts. It wouldn’t be good for you.

And then there’s the whole classpath abomination.

Or the fact that there’s no way to specify the encoding of your Java source file in that same source file so you don’t lose it? Once again I demand to know: WHAT THE HELL WERE THEY THINKING‽‽‽

Stop the madness! I can’t believe people put up with this garbage. It’s a complete joke. I’d rather be a Walmart greeter than suffer the slings and arrows of outrageous Java insanity. It’s all broken, and they not only can’t fix it, they won’t fix it.

This by the same foxy-grapey people who prided themselves on a language that made it illegal to have a printf() function. Gee, that sure worked out real well, didn’t it though!?

Sheer numbskulls. Bitch-slapping is too kind for them. If I wanted to program in assembler, I would. This is not a salvageable language. The emperor has no clothes.

We hates it. We hates it forever. Let it die die die!

share
4  
-1. With the exception of regexp comments and Unicode escapes, not a single one of the things you mentioned is a syntax element. –  Jörg W Mittag Nov 21 '10 at 11:25
2  
+1 for the ranting. –  Agos Nov 21 '10 at 16:44
3  
@Jörg, you want syntax? Ok fine: Java allows you to put control characters, include ESC and NUL, in identifiers. WTH were they thinking??? –  tchrist Nov 22 '10 at 22:12
4  
@tchrist: Wow! If I ever write a Java program again, all my variables will have names consisting of varying numbers of backspace characters (^H) :) –  j_random_hacker Nov 29 '10 at 12:44
1  
@tchrist, feeling better now? –  user1249 Jun 23 '11 at 9:25

& && | || in C

C++ has rectified it to some extend with explicit "and" "or" keywords. Many a bugs and torn hair could have been avoided in C if logical operations and bitwise operations weren't so hard to differentiate.

share
1  
The and and or keywords are provided by <iso646.h>. #include that your C programs and that's a complete non-issue. C++ is also required to provide the same header. –  greyfade Oct 29 '10 at 18:16
4  
I've never ever had trouble distinguishing the two... –  Carson Myers Dec 7 '10 at 4:13
1  
That's nonsense, it's trivial to remember and optically very different. Using the keyword and is even a bigger nonsense. Without reading the definition, what does and mean? Is it logical or bitwise? People confused by the difference between & and && probably need something like logand and bitand. –  maaartinus Apr 27 '11 at 3:04

Since people have already complained about = vs. ==, let me point out a much worse alternative. PL/I had both := and =, but when something was "obviously" an assignment, it would let you get away with using = to do it. Using := let you force something to be an assignment in a situation where the compiler would otherwise interpret it as a comparison.

Unfortunately, the compiler didn't always decided on things quite the way you might expect. Consider just one obvious example:

A = B = 0;

Now, to most people familiar with most "ordinary" languages, the meaning of this is pretty obvious -- assign 0 to both A and B. PL/I is just a bit...different though. For reasons known only to the (insane) designers of the language, the first = is interpreted as an assignment, but the second = is interpreted as a comparison. Therefore, this compares B to 0, and then assigns the result of that comparison to A (following the C-style convention that "false" results in 0 and "true" in 1).

So, if B was 0, then A becomes 1. Otherwise, A becomes 0. In other words, rather than assigning the same value to A and B, this actually ensures that A cannot have the same value as B.

Bottom line: even though the C/C++/PHP style initially seems like a pain, the alternative is much worse1.

1Well, technically, there's another alternative: Pascal style, where = always means comparison and assignment always requires :=. After using that for a while, it's pretty obvious (at least to me) that assignment is enough more common than comparison that if you're going to require extra "stuff" to disambiguate the two, you should definitely keep assignments clean and simple and require the extra "grunge" on comparisons, not vice versa.

share
1  
I'd even propose to use == for equality and := for assignment. This way you have more to type, but avoiding the lonely = helps to avoid bugs. –  maaartinus Apr 26 '11 at 22:20

Function pointer declaration syntax in C and C++:

(int)(*f)(int, int);

That declares a function pointer named f whose pointee can take two ints and return an int.

I'd much prefer a syntax like this:

f: (int, int) => int

Say you want to declare a function pointer g whose pointee can take two ints and a function from int and int to int, and return an int.

With C or C++ notation, you'd declare it as:

(int)(*g)(int, int, int(int, int));

With the above-proposed notation same thing can be declared as:

g: (int, int, (int, int) => int) => int

Latter is much more intuitive IMO.


Aside: The programming language called OOC fixes this syntax (and various other syntactical issues in C and C++). Check out its homepage here.

share

Javascript/Java etc, equals comparison, eg if(a==1)

How many times do I write if(a=1) ?

As a human I read that perfectly. But the darn interpreter/compiler says, "hey I'll assign 1 to a, then check if a is equal to 1, and would you believe it yes it is!

Drives me up the wall.

if(a==1) is far less readable, and the interpreter/compiler should know what I mean anyway; many other lesser languages (VB) have been working it out successfully for hundreds of years.

share
2  
Assignment just shouldn't return a value. It's sometimes useful, but in most cases it's just a pain in the neck. –  configurator Sep 29 '10 at 6:59
3  
@Tom: It means you don't understand booleans. If you meant if (a == true), just write if (a). If you meant a = true, then the if statement is redundant. –  dan04 Feb 27 '11 at 16:27

Commenting in CSS

// doesn't comment out lines of code like it does in many other languages, like PHP and Javascript. Although /* this is commented out */ works, I prefer to use //.

Its a nuisance, because half the time I forget I am editing CSS and then have to go back and fix the error.

share
1  
@MVCylon If you use // to comment out a line, anything after that following line also is skipped. {within that specific style} In other words, it FAILS because those lines should not be skipped. –  Talvi Watia Oct 2 '12 at 1:26

VBScript Doesn't Have Logical Operators

Unlike nearly every sensible language, VBScript uses bitwise operators instead of logical operators. What does this mean in practice? Well, as Eric Lippert points out:

If Blah = True Then Print "True!" Else Print "False!"

and

If Blah Then Print "True!" Else Print "False!"

are NOT the same in VBScript!

Even worse, though, this means that there is no short-circuit evaluation in VBScript so that the following statement will crash your program if Blah is Nothing

If (Not Blah Is Nothing) And (Blah.Frob = 123) Then
...

That's right, VBScript will evaluate both parts of the AND comparison, even if the first one is false! Just let that sink in...

share
3  
Until the day you've hunted a bug inside an If x Then ... If Not x Then ... End If ... End If and figured out that x is 2, you haven't really programmed in VB/VBScript. –  configurator Sep 29 '10 at 6:54

The for ... in construct in JavaScript and the foreach construct in PHP when looping over arrays. Both of them make it easier to write bugs than correct code.

share
3  
Wow, that is such bullshit. “than correct code”. Go away. –  Jonathan Sterling Oct 15 '10 at 17:46
1  
I'm confused, I thought it was common knowledge that the "for..in" construct in javascript is broken... why is this offensive? –  lvilnis Jan 15 '12 at 8:40

Array declarations in C and C++.

Typically, a variable declaration is of the format type variable_name. You can easily read those declarations in a left-to-right manner. But int foo[size] looks at first like it's declaring foo as an int, and then you read further and see that foo's of type "array of integers." int[size] foo reads much better.

And I also hate it when programmers declare pointers like this for a similar reason: int *foo. For some reason I haven't figured out, that's the typical way it's written.

share
1  
Re pointer declarations: they're written like that because the '' binds to the variable name, not the type. So int* a, b; does *not declare a and b as pointers; only a is. Hence it's better to write it as int *a, b; (or even better to write them as two declarations). –  Steve Melnikoff Sep 17 '10 at 21:35
2  
And this is to say nothing of function pointers... void(int) *f;? Nope: void (*f)(int); –  Note to self - think of a name Sep 18 '10 at 17:01
2  
@Steve Melnikoff: Although I +1ed this answer, I think that int* a, b; issue you mentioned is much more egregious. –  j_random_hacker Nov 29 '10 at 12:40

I despise the fact that curly braces can be optional after an if/while/for statement.

Especially when I see code like,

if (...)
    for(...)
        ... One line of stuff ...

Please just put the braces in and be done with it.

share
6  
Hmm.. this depends. For "Abort Ifs" which merely check a condition and return an error code (or throw an exception), I'd much rather not see the braces. –  Billy ONeal Sep 18 '10 at 3:48
4  
I would agree if you limited yourself to extreme multi-level cases, but your statement is too blanket. There is great utility in the ability to have short forms for simple, single-statement ifs and loops. –  Timwi Sep 18 '10 at 12:12
2  
My rule: only if a statement requires multiple substatements or if it contains such a statement should it be wrapped in braces. Thus for (...) while (...) if (...) { x(); y(); } is better rewritten as for (...) { while (...) { if (...) { x(); y(); } } }, with appropriate indentation, of course. –  Jon Purdy Sep 20 '10 at 12:10
6  
I'm rather the opposite -- I despise people who insist on putting in braces when they're completely unnecessary. Just learn to program. –  Jerry Coffin Oct 16 '10 at 18:42
3  
I really like the brackets even in single if statements. It makes me follow the flow of a program better. –  Ricardo Santos Dec 29 '10 at 16:32

Redundant parameterization in Java:

HashMap<String,HashMap<String,String>> foo = new HashMap<String, HashMap<String, String>>();

What other type parameterization does the compiler think foo could have?

share
4  
I hope you are aware of Java's (limited) type inference? HashMap<String,HashMap<String,String>> foo = Maps.newHashMap(); –  finnw Sep 10 '10 at 19:49
1  
Java 7: HashMap<String,HashMap<String,String>> foo = new HashMap<>(); –  Bart van Heukelom Sep 18 '10 at 10:50
5  
Well it can have any type it wants, the types are erased anyway... –  configurator Sep 29 '10 at 6:58

The fact that Python relies on text formatting.

share

Python

self parameter in instance method definitions

share
4  
I understand the reasons and why it is left there neopythonic.blogspot.com/2008/10/… but I still don't like it –  Goran Peroš Sep 11 '10 at 21:23

Scala multi-line code in brackets

For instance:

class Foo(
         val bar: String,
         val baz: Int,
         val bing: String,
         val bong: Boolean
 ) extends Model {
   // body here
 }

What you actually get from it is terrific. It generates the constructor and the getters and setters for you. But it sure is ugly and breaks all my mental models of how to indent code and basically leaves me feeling like I'm in a sort of bizarre sandwich with Java on one side and Lisp on the other. (Oh, wait... that is rather the point of Scala.)

share
3  
The portion in the parentheses. I'm English. We refer to those as brackets, damnit, because in that situation they aren't serving a parenthetical role. –  Tom Morris Sep 22 '10 at 11:39
2  
It doesn't look all that bad if indented this way: pastebin.com/h9qC8XGg –  missingfaktor Oct 15 '10 at 17:52

reinterpret_cast<unsigned long> in c++. This operation is useful in dealing with foreign APIs and ensuring numerical precision, why should it be such a pain to type and so ugly to look at?

share
17  
It's ugly to remind you that you should strive to write code that doesn't require it. :) –  greyfade Sep 4 '10 at 20:58
5  
It's not really a theoretical CS argument: Using a reinterpret_cast in C++ is a very strong code smell. 99% of the time, when you are about to use it, chances are, you shouldn't need to - you probably did something wrong. The other 1% of the time, you're interfacing with C. reinterpret_cast breaks the type system to make something work when it otherwise can't. That's usually a bad thing. –  greyfade Sep 18 '10 at 5:52

In/out arguments. I'm all for in arguments (good thing I am), out arguments are fine too, but an argument that must convey these two states pisses me off.

What I target here are functions that take input from a parameter then overwrite that input with some output. It's okay to pass an object by reference to update it. But, mostly for primitive types, taking an object, use it, then change it completely, is not right by me. You shouldn't change the meaning of the argument through an inout.

share

Perl

  1. I wish Perl let me write if($x < 10) do_something();. At the moment, you have to write that as either do_something() if($x < 10); or as if($x < 10) { do_something(); }.
share
9  
do_something() if ($x < 10); isn't that bad. –  zneak Sep 3 '10 at 20:23
7  
It's unfortunate until you write if ($x<10) do_something(); and_call_me(); and then wonder why you never get a call. I wish C and family would require the braces, to prevent that type of error. –  AShelly Sep 4 '10 at 17:13
2  
@AShelly: or why you always get a call, actually. –  zneak Sep 10 '10 at 1:04
1  
@zneak Except no elses. (I wish it has EXPR1 if COND else EXPR2 like Python has) –  SHiNKiROU Sep 21 '10 at 3:53

Semicolons in VBScript - or the lack thereof

I spend all day working in languages that expect semicolons at the end of each line. Add one to the end of the line in VBScript and your code doesn't run anymore.

share
4  
up-voting this, not because I particularly like semicolons, but because I really hate the way VB encourages really long lines by making linebreaks so inconvenient. –  Shog9 Sep 18 '10 at 3:57

Verbosity in Java.

ie:

public static final int 
share
6  
Compared to? (15 chars) –  TheLQ Sep 3 '10 at 1:44
7  
Compared to: const int for instance. –  OscarRyz Sep 6 '10 at 23:27
11  
"public static final int x = 4;" compared to "x = 4" in Haskell. –  Jared Updike Sep 8 '10 at 23:52
24  
That's not verbosity. Try writing a+(b*c)/d*e+f/g^20 using BigInteger in Java. Why does this language not allow operator overloading? –  MAK Sep 20 '10 at 10:07
4  
@Michael: programmers who need to be protected from themselves at this cost can best protect themselves (and reduce the pain for everyone else) by not programming at all :D. –  MAK Mar 18 '11 at 3:03

Pointers of arrays or arrays of pointers in C/C++. I am still confused about these.

share
3  
Read the type backwards. int[]* is a pointer to an array of integers, and int*[] is an array of pointers to integers. Works well with consts too: int* const is a constant pointer to integers, whereas const int* and int const* are pointers to constant integers (or to integer constants). –  zneak Sep 2 '10 at 22:42
4  
@tchrist: Not true. int (*p)[10]; declares p to be a pointer to an array of 10 ints. If sizeof (int) == 4, then p++ will advance p by 40. –  j_random_hacker Nov 29 '10 at 12:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.