std::min and 32/64 bits.

A

Andrea Venturoli

typedef std::vector<X> Xes;
Xes V;

Actually I had thought about "typedef"ing eithre
std::vector<X>::size_type or std::vector<X>.
So far I'm more inclined toward the second.




Xes::size_type const VLimit = 1000;
...
As result your problem is removed, the code works everywhere:

std::min( V.size(), VLimit );

This might be another good solution, actually.


Thanks
av.
 
T

Tobias Müller

Seungbeom Kim said:
I'm not speaking for the OP's case, but in a very general sense, you
may not know the exact set of possible target platforms in advance.

Sure. Generally, I try to produce portable code. But in that special case I
think it's too much
If you're committing the code to a public repository, you never know
who will use it on which platforms.

I was assuming that he is not working on a public repository, because he's
paid for it. But you're right it's possible.
Even you could upgrade the system
and see new warnings occur.

Warnings are not bad per se. They tell me there's a potential problem. I
analyze it, fix the problem, and the warning is gone.

Generally, it's more efficient to fix the problem when you see the warning
rather than beforehand:
- You don't have to search the code for potential problems because the
compiler tells you where they are.
- There are good chances that you actually never have to do it anyway.

Usually, persons that pay other persons for doing some work don't care
about such academic non-problems. If they pay someone to eliminate warnings
they do that because:
A) if it's a bug it, will cost money for support and bugfix and hurts the
reputation of the software, which drives away potential customers.
B) if it's no bug it distracts from real bugs and makes those more likely,
which costs money (see A).

But no warning -> no distraction and no bugs -> costs no money.

That's why I doubt that he is really meant to "fix" such special cases.

Tobi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top