Question: I was discussing with a friend the following function prototype:

```
void str_buf_append(const char&);

```

The purpose is simply to add a character to a string buffer along with some other tasks irrelevant to the current question, which is: Given that we're not modifying the input character, is it better to pass by reference here or by value?

My friend's argument was that if you pass by reference for a char, you're putting onto the stack something with the size of an int whereas if you pass by value, you just put something on there that's only a byte in size.

In my opinion, though, that's not the whole picture: When you pass by value, I think you're actually doing the following:

1. Create a copy of the character at some location in memory distinct from that of the original character.
2. When the function is called, push onto the stack a reference to the copied character, thus not saving anything because under the hood, you're still using a pointer--just a pointer to a different memory location.

So my conclusion/opinion is that it is indeed more efficient to pass by reference than by value in this case.

Who is right?

Answer: 
The fact is that you can't predict what it will look like after optimizations take place; the only thing that stays "fixed" is the semantics of the code, not how it is actually executed.
You're both wrong. There are no 1-byte stack slots. But when you pass a char by reference:

1. You have to compute its address. If it's static, that's constant. If it's in an object, you have to add an offset to the object's address. If it's on the stack, method-local, you have to add its stack frame offset to the current stack frame pointer. On an x86 that's all done with the LEA instruction, but are you on Intel hardware?
2. You then have to push the address.
3. Then, every time you use it in the target method you have to dereference it.

All this is many more memory references than just pushing the value onto the stack.

Whether it really matters in a non-trivial method is another question. And of course it is open to the compiler to compile it as pass-by-reference anyway in some circumstances.