Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > std::min and 32/64 bits.

Reply
Thread Tools

std::min and 32/64 bits.

 
 
Andrea Venturoli
Guest
Posts: n/a
 
      01-30-2013
On 01/29/13 17:53, Öö Tiib wrote:

> 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.
 
Reply With Quote
 
 
 
 
Tobias Müller
Guest
Posts: n/a
 
      01-30-2013
Seungbeom Kim <> wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57