jhg
Joined 17 years ago
Joined 17 years ago
void foo(int * a) { }
void bar(int * b) { foo(b); }
void baz(const int * c) { bar(c); }
Point being is that the compiler should warn of the const violation based on whether a function argument or a class member is getting touched in the function code.In fact, the example above is more relevant, because what I am ultimately aiming for is to not need to make member functions const, and yet be able to call them for const class instances.
Does anyone knows any research or even a state of affairs of const inference in language design?
The idea is similar to type inference whereby a compiler (or some other tool in a chain) would take care of understanding which arguments/variables/functions are going to be const and generate appropriate warnings based on that. For example,
void foo(int * a) { (*a)++; }
void bar(int * b) { foo(b); }
void baz(const int * c) { bar(c); }
A compiler would generate a warning when baz function, because foo() includes a non-const operation on its argument, bar() is non-const for the same reason, and so it cannot be called for a const pointer.> Looks like you have a question or two that still needs to be filled out.
If I want to skip a question, I should be able to do so.
What a hypocrisy.
Determining what consumers wanted was the goal of having public consultations. It worked out that consumers didn't want what the (heavily lobbied) government officials wanted, so whatever the public said was quietly ignored and they proceeded pushing for a bill that they had.
"Let the consumers decide what they want" my ass.
Just to emphasize - EIGHT PERCENT of my coworkers came from Chinese software development companies and they quite naturally brought their work ethics with them. My four years in this company is a basis for my original comment.
If it's not obvious, I am not talking about Chinese nationality, I am talking about developers with Chinese way of working in a software development environment. The way that revolves around never saying No to the boss, which in turn is deeply rooted in their cultural heritage. If the project manager says that the bug needs to be fixed today, it will be fixed today. Meaning that it will no longer be reproducible. How it will be fixed and what else is going to broken along the way is secondary. This will create another bug that can be taken care of later in the same manner.
And this was the company that developed sophisticated networking software including their own embedded OS down to the kernel level. Moreover most of these guys were perfectly capable of NOT cutting corners and doing a splendid coding job if forced. But god forbid if they would ever do it on their own accord. Everything was always done in a rush and sketchy-patchy way. I don't have any other explanation except for it to be a cultural thing.
You can certainly call it a horseshit and a casual racism if you'd like. However that's how things are in reality.
Oh, don't start. "I don't know what the bug was, but I fixed it." - verbatim quote. This was a mode of operation of disturbingly large number of Chinese devs I have worked with. After several bugfixing iterations of this kind it was easier to throw the code away and redo it from scratch than to understand how that managed to work. So, yeah, "don't have to be exact" is certainly there.