re: sportsball 

Imagine being up 17-3 and not looking dominant

re: sportsball 

@coriander my PC and consoles are packed so I can't play video game o________o

re: sportsball 

@wallhackio :bing: getting dommed by the sportsball team

re: sportsball 

@wallhackio Fix your boredom (and also my boredom) by telling me something interesting about C++ :blobcat_mlem:

re: sportsball 

@vaporeon_ there is exactly one lvalue in C++ that sometimes throws when given to the & operator. can you think of what it is?

Hint: while this kind of expression exists in C, it is not considered an lvalue in C!

re: sportsball 

@vaporeon_ would you like me to tell you the answer

re: sportsball 

@wallhackio I remember that you told me that in C++, I can do (cond ? a : b) = 123;. I definitely can't do that in C, even though it's cool and would save some typing

Are there others that are not lvalue in C, but are in C++? Because I can't imagine how to get an error by passing this to the & operator...

re: sportsball 

@vaporeon_ in C++, functions names are considered lvalues! I cannot say for certain why this decision was make, I would guess this was probably so that "names of things" could correctly describe lvalues

However, a function name is ambiguous if that function is overloaded, so the & operator throws on the name in that case

I'm bad at C++ 

@wallhackio Can you tell me what I'm doing wrong? I wanted to test "function names are considered lvalues" by assigning a function to a function, but it's not compiling

#include <stdio.h>
void hello() { printf("Hello, world!\n"); }
void bye() { printf("Goodbye, world!\n"); }

int main() {
void say();
say = hello;
say();
say = bye;
say();
return 0;
}

re: I'm bad at C++ 

@vaporeon_ im pretty sure functions cannot be reassigned

in C++ land, where things no longer make sense, there are many lvalues which cannot appear on the left hand side of an assignment

re: I'm bad at C++ 

@wallhackio I thought an lvalue is something that can appear of the left side on an assignment, and that's why it's called an lvalue? :psyduck:

When did they change that and why?

re: I'm bad at C++ 

@vaporeon_ in C that was the case because C makes sense. In C++, there are expressions called "lvalue" because C had expressions called "lvalues" and most of them are considered "lvalues" in C++

re: I'm bad at C++ 

@vaporeon_ if you want a real answer then I have my (extremely biased) notes here: github.com/calebmsword/cpp-not

You don't need to read the whole thing to understand lvalues. Just read up to the section titled C++11.

re: I'm bad at C++ 

@wallhackio Whitespace in filename :clodsire_angy:

re: I'm bad at C++ 

@vaporeon_ there I fixed it :) (by committing directly to the main branch :)))))

re: I'm bad at C++ 

@wallhackio As you should (why wouldn't you commit directly to the main branch for a project where you are the only one who has write access?)

re: I'm bad at C++ 

@vaporeon_ but its "bad practice" vaproeon i must do it properly by creating a github issue and then assigning myself to it and then making a new branch for work for that issue and then making changes there, and then making a merge request from that new branch :)

re: I'm bad at C++ 

@vaporeon_ I actually use git on the command line, even on windows, so whitespace for a filename is annoying for me

not the first time i made things unnecessarily difficult for myself, won't be the last :)

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.