List* l or List *l? The Oldest Style War in Programming
Three spellings that mean the same thing to the compiler. People have argued about where the asterisk goes since the 1970s, because the question is really about what a declaration is. Here's the whole debate, and how Go avoided it.
Here are three function signatures. To the C++ compiler they are identical. They are read the same way, they have the same types, and they produce the same machine code.
void add(List* l);
void add(List *l);
void add(List * l);
The spaces around the asterisk mean nothing to the compiler. Even so, where to put the asterisk is one of the oldest arguments among C and C++ programmers. It started about fifty years ago, and it still comes up in code reviews today.
I don't think it lasts because programmers like arguing. It lasts because it isn't really about spaces. It's about what a declaration is. Both sides are right about something. The language's grammar supports one side, and the way most programmers think about types supports the other.
This post covers the whole debate: what each side believes, the grammar rule underneath, the trap that started the classic C style, how complicated declarations can get, and how newer languages avoided the problem.
Camp 1: List* l, the asterisk belongs to the type
This is the modern C++ view. The asterisk is part of the type. The variable's type is "pointer to List", so the symbol that says "pointer" should sit next to List. The declaration then reads as a type, followed by a name.
List* l; // read as (List*) l, "l has type pointer-to-List"
C++ programmers tend to think about types this way, because in C++ a type is something you work with directly. You can pass List* to a template, give it another name with an alias, and choose between functions based on it.
Bjarne Stroustrup, who created C++, writes int* p. In his FAQ he describes the split like this: C++ programmers tend to focus on the type, and C programmers tend to focus on the expression. Most modern C++ codebases and style guides follow Camp 1.

Camp 2: List *l, the asterisk belongs to the variable
This is the classic C view. The asterisk goes next to the name.
List *l; // read as "*l is a List"
The idea behind it is called declaration mirrors use, and it's not just a habit. It's how C was actually designed. Dennis Ritchie, who created C, made declarations work like this: you write an expression that uses the variable, and in front of it you write the type that the expression produces.

So List *l; says that when you write *l, you get a List. The declaration shows how the variable is used. That's also why int a[10] puts the brackets after the name: the expression a[i] is an int. And it's why function pointers in C look the way they do.
So Camp 2 has the language's grammar on its side. It has one more argument too: a trap that catches people who write in Camp 1's style.
The trap
Declare two pointers on one line, in Camp 1's style.
List* a, b;
This looks like it declares two pointers. It doesn't. The compiler reads a as a List* and b as a plain List.
The reason is Ritchie's grammar. The asterisk was never part of the type. It belongs to the name that follows it. So the compiler actually reads the line like this.
List (*a), (b); // one pointer, one value
To get two pointers, you have to write the asterisk once for each name. That forces you into Camp 2's spelling.
List *a, *b; // now both are pointers
This is why many C programmers learned to put the asterisk next to the variable. Their style makes the code look like what the compiler does. Written in Camp 1's style, List* a, b; looks like it means something it doesn't. Written as List *a, b;, it at least shows that only a has the asterisk.
Camp 1's answer is a rule rather than a spelling: always declare one variable per line. That rule is in the C++ Core Guidelines, and it makes the trap impossible.
Here is the debate in short. Camp 1 matches how programmers think, where a type is a thing. Camp 2 matches how the compiler reads, where a declaration is an expression. Each side needs one extra rule for the case where its own view doesn't work.
How deep the rabbit hole goes
If "declaration mirrors use" stopped at *l, either style would be fine. But with more complicated types, the rule gets hard to read, and that's why many people dislike it.
Here is a pointer to a function that takes two ints and returns an int.
int (*fp)(int a, int b);
That's still readable, but only just. The parentheses around (*fp) are needed. Without them, the line would declare a function that returns a pointer. Now make one of the parameters a function pointer too, and leave out the parameter names, which C allows.
int (*fp)(int (*)(int, int), int);
Rob Pike made this point when he explained why Go dropped C's style. In int (*)(int, int) it's not clear where a name would go. It's not even obvious that the thing is a function pointer.

If the function also returns a function pointer, you get declarations that you have to read from the inside out, going around the parentheses.
int (*(*fp)(int (*)(int, int), int))(int, int);
That's a real, legal declaration. It has the same shape as one of the best known hard-to-read lines in C, the declaration of the Unix function signal().
void (*signal(int sig, void (*func)(int)))(int);
C programmers invented a reading method for these, called the clockwise spiral rule. They also built a tool, cdecl, whose only job is to translate C declarations into English, and it's still online. When people need a tool to read a syntax, I think the syntax is the problem. Modern C++ handles this in two ways. An alias gives a complicated type a short name, and auto lets the compiler work out the type so you don't write it at all.
How Go ended the war
Go's designers had seen fifty years of arguments about the asterisk, the two-pointer trap and the spiral rule. They made a change that C couldn't make without breaking old code: they reversed the declaration.
In Go, the name comes first and the type comes second, and you read from left to right.
var l *List // "l is a pointer to List"
var a, b *List // both pointers, no trap possible
f := func(x, y int) int { ... }
var fp func(func(int, int) int, int) int
The last line is the hard-to-read declaration from the previous section. fp is a variable that holds a function. That function takes two arguments, another function and an int, and returns an int. In Go you can read it from left to right in one pass, the same way you would say it aloud. Pike described the design like this: the name always comes first, so it's always clear what is being declared, and the type after it reads like a sentence.
This removes the whole debate. There is nowhere to put a space that matters, because *List is one type, written in the type's position. The asterisk can't attach to the name, so Camp 2's grammar argument no longer applies. When you declare several names, they all share one type, so the trap is gone too.
Both sides got what they wanted. Camp 1 said the asterisk is part of the type, and in Go it is. Camp 2 said a declaration should not look like something it isn't, and in Go it can't. Neither side won. The thing they were arguing about was removed.
Go wasn't the only language to do this. Java kept C's order, type first, but moved array brackets onto the type, so you write int[] a instead of int a[], for the same reason. Java still accepts the old C spelling, which shows how long these habits last. Rust, Kotlin, Swift and TypeScript all followed Go's order, with the name first and the type after it.
The genre, not the instance
The asterisk debate is the best known of a whole group of arguments, where the compiler doesn't care and people do.
const int versus int const is the same debate with a different word. The compiler reads both the same way, and people read them differently. Where to put braces, tabs versus spaces, and i++ versus ++i in a loop are other examples.
Each of these lasts for the same three reasons. Either choice costs nothing. Mixing the two styles in one codebase does cost something, because it makes the code harder to read. And each style reflects a different way of thinking about the code.
That's why arguments don't settle these debates. A decision does: a style guide, a formatting tool, or a language designer who removes the choice.
That's the real lesson here. gofmt comes with Go and allows exactly one format, so the asterisk debate can't happen in a Go codebase. The cost is that nobody gets their personal preference. C++ leaves the choice open, and the cost is many small arguments in code reviews. Both have a cost, but only one of them still causes arguments fifty years later.
Where to stand
If you write C++ every day, the practical answer is short. Follow the convention your codebase already uses, declare one name per line, and let a formatter such as clang-format enforce it. Then the question stops mattering, which was the goal all along. If you are choosing for a new team, List* l with one declaration per line is the most common modern C++ style, and the trap can't happen with it.
And if Go's pointer declarations have ever looked backwards to you, coming from C, they aren't backwards. They are the design that ended this debate.
Check yourself
3 questions · nothing is saved- Written
- Apr 3, 2026
- Length
- 1,664 words · 8 min
- Built
- …
- Served by
- …
- Delivered
- …
- Over the wire
- …
- Go's share
- …
From C++ to Go: Demystifying Pointers, Slices, and Errors
Go code looks like C++, but the ideas behind it are different. Three things I had to learn again while building a todo app in Go: errors are values, a slice is a small header that points at the data, and the asterisk does two jobs.
- 1C++ 101: The Language That Trusts You Completely
- 2Go 101: A Small Language for Big Systems
- 3The Two Jobs of the Asterisk: Pointers in Go and C++
- 4List* l or List *l? The Oldest Style War in Programming
- 5From C++ to Go: Demystifying Pointers, Slices, and Errors
- 6Why Go Rewrites 0644 as 0o644 (and Why chmod Won't Take 'rwx')
Memory: The Stack, the Heap, and Pointers
Where your variables actually live, why the heap costs more than the stack, and what a pointer really is.
OpenCV 5: What Actually Changed Under the Hood
The first major version since 2018 is about foundations, not new features: a rebuilt engine that runs over 80% of ONNX instead of 22%, real n-dimensional arrays, fast code from four chip makers, and a list of removals long enough to break your build.
OpenCV 101: Every Image Is a Grid of Numbers
A photo is a rectangle of numbers, and everything OpenCV does is arithmetic on that rectangle. Mat, BGR, convolution, thresholds, contours and perspective warps: the ideas that make the library's 2,500 functions easier to find your way around.
Projects built with what this post is about.


