FaTony wrote:I thought your problem was to convert bytes to RGBA array. It solves exactly it.
No! The problem was quite different: we want to
interpret RGBA bytes as array of integers, currently without any modifications. What will be done with them after - we don't care.
FaTony wrote:
How else would you write a function with wide contract? You haven't told us anything else about your function.
Right! I didn't told anything about function. Because this function just demonstrates that
static_cast doesn't work on this example. But this example can be related to the real task that needs to interpret raw data as pointer to beginning of an array of elements of some type.
FaTony wrote:
Yes, because it is idiomatic. Almost all of the standard library uses exceptions.
It's not idiomatic, it's idiotic. Because it is not binary-compatible with other environment if the function will be placed in a shared library. Some code imports your library, calls the function and crashes without any possibility to handle the error.
FaTony wrote:
Wrong. The compiler will perforrn Named Return Value Optimization. If it doesn't, it will call a move constructor. No copy will ever be made.
Maybe it's true since C++11. In reality I wouldn't ever rely on a compiler.
FaTony wrote:
Because you can't do anything else while being standard conforming.
Because the original problem doesn't require any math.
FaTony wrote:
This is exactly why I avoid writing low level code and prefer to use classes which have a clean, well designed interface.
This is exactly because of your misunderstanding of platform you're writing for.
FaTony wrote:
I never claimed to be. I prefer correctness, portability and abstractness first and I design reusable components which can solve many cases.
This is a common problem of C++ developers. They often write 'common code' and fight with templates instead of doing something useful. The availability to write nine-floor templates (and get tons of generated machine code, lol) and decrypt multi-screen error messages raises the feeling of self-importance. But! It's not a target. You're not writing code because you need to write it. You write the code to solve the specific problem, not for the show 'the most beautiful compilation unit'.
FaTony wrote:I don't care. The common complaint I get is that my libs are [A]GPL and people love to write proprietary software and really hate [A]GPL. I couldn't care about them.
This is bullshit. How is the quality of code relative to licensing policy?
UPD: About three big lies