Rightconst.dev – Put const where it belongs(rightconst.dev)
rightconst.dev
Rightconst.dev – Put const where it belongs
https://rightconst.dev/
3 comments
most of these combinations actually have legitimate use-cases. and, kind of like what the article is pointing to; it's really only confusing if you learnt it the bad way from the start.
that said, I think the more extreme examples probably come from C codebases, where these kinds of declarations are actually highly useful as well as highly logical, compared to C++ which usually tones these kinds of things down via STL and higher level abstractions.
i'd also argue both C and C++ still have their place as legitimate tools for their purposes, and especially C still has no real competitor that can match it for its purposes.
that said, I think the more extreme examples probably come from C codebases, where these kinds of declarations are actually highly useful as well as highly logical, compared to C++ which usually tones these kinds of things down via STL and higher level abstractions.
i'd also argue both C and C++ still have their place as legitimate tools for their purposes, and especially C still has no real competitor that can match it for its purposes.
I would argue that if you need to learn it the right way in order for it to make sense, then what that really means is that you just get used to it and it's not very intuitive to begin with.
Take the simple example of a pointer. It's just a data type, but it gets its own symbol. Ints or floats do not get their symbol, and pointer similarly could just be a keyword and not a symbol to be consistent. Pointer could be a type keyword for declaration, and * (asterisk) could be the operator to retrieve a pointer value. This disambiguates it easily and intuitively.
But again, I still like C++ and consider all of these inconsistencies as side effect of its longed lived legacy. It needed to change and evolve and making comprises is hard when it's already part of so many systems. I'm also not sure there's anything better. I have not yet learned Rust but it seems it's aiming for a different kind of experience alltogether. Not sure what could be the real successor to C++ while still remaining compatible in the way C++ is to C.
Take the simple example of a pointer. It's just a data type, but it gets its own symbol. Ints or floats do not get their symbol, and pointer similarly could just be a keyword and not a symbol to be consistent. Pointer could be a type keyword for declaration, and * (asterisk) could be the operator to retrieve a pointer value. This disambiguates it easily and intuitively.
But again, I still like C++ and consider all of these inconsistencies as side effect of its longed lived legacy. It needed to change and evolve and making comprises is hard when it's already part of so many systems. I'm also not sure there's anything better. I have not yet learned Rust but it seems it's aiming for a different kind of experience alltogether. Not sure what could be the real successor to C++ while still remaining compatible in the way C++ is to C.
That's just silly. I like C++ for its legacy and contributions but my god is it a confusing AF language for no reason. It can easily have syntax for each of these cases instead of reusing keywords and symbols in the most confusing way.