Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2466 Discussions

Warnings in Visual Studio 2008: C4512, C4127, C4244, C4100 (#include <concurrent_hash_map>)

Boris_Dušek
Beginner
1,763 Views

Hi,

I downloaded TBB (tbb21_20080605oss binary for Windows)and started using concurrent_hash_map. However using it triggers warnings by Visual Studio (I am compiling on the highest warning level). I have a habit to compile without a single warning, so I clearly want to iron them out. Some of these can be easily fixed, so it would be great if the fixes made it to some future release :-)

All warnings I am seeing (along with comment on how/whether it's possible to fix them)

tbb21_20080605oss\include\tbb\concurrent_hash_map.h(585) : warning C4512: 'tbb::concurrent_hash_map::node' : assignment operator could not be generated

- not sure if this is something because of my use of the template, or a general thing; if general, private: node &operator=(const node &); should solve it (I am using concurrent_hash_map with Key = std::wstring and T = std::vector<:DICT::WORDSTAT> and WordStat is a struct of size_t and another struct of 2 std::wstring: WordStat "=" struct { size_t; struct { std::wstring; std::wstring; enum }; };

tbb\concurrent_hash_map.h(730) : warning C4127: conditional expression is constant

tbb\concurrent_hash_map.h(742) : warning C4127: conditional expression is constant

- I don't think this can be solved :-) unless the warning is explicitly disabled locally for the one line with #pragma warning(push,pop) (and #ifdef'ed for _MSC_VER only)

tbb\atomic.h(162) : warning C4244: 'argument' : conversion from 'tbb::internal::atomic_traits::word' to 'char', possible loss of data

- not sure what this means

tbb\concurrent_hash_map.h(578) : warning C4100: 'size' : unreferenced formal parameter

- this is clearly general problem and solvable by commenting size out: (size_t /* size */, node_...)

Boris

0 Kudos
1 Solution
ARCH_R_Intel
Employee
1,765 Views
For the record, I committed the clutter that eliminate /W4 warnings for VS2005 and VS2008. The changes will show up in future releases. There did not seem to be any way to appease VS2003 without seriously damaging the readability of the sources.

View solution in original post

0 Kudos
26 Replies
ARCH_R_Intel
Employee
1,766 Views
For the record, I committed the clutter that eliminate /W4 warnings for VS2005 and VS2008. The changes will show up in future releases. There did not seem to be any way to appease VS2003 without seriously damaging the readability of the sources.

0 Kudos
Boris_Dušek
Beginner
335 Views
For the record, I committed the clutter that eliminate /W4 warnings for VS2005 and VS2008. The changes will show up in future releases. There did not seem to be any way to appease VS2003 without seriously damaging the readability of the sources.

Thank you Arch, I really appreciate that.

0 Kudos
Boris_Dušek
Beginner
335 Views

/W4 can't even check the paint right. The quality issue is with the compiler, not the library. The compiler is issuing unreasonable warnings because it is being sloppy about analysis and written for C programs, not modern templated C++. Of hundreds of /W4 warnings I eliminated, only one said anything reasonable, forthe new class thread_specific_enumerable. I find real issues by code review much more efficiently than wading through these misguided warnings.

I feel I need to reconsider what I expect from /W4 (apart from satisfying Alexandrescu's point 1. "Compile cleanly at high warning levels" in "C++ Coding Standards").

0 Kudos
uj
Beginner
335 Views

I note that the level /W4 warnings have been removed as of TBB 2.1 Update 2. This puts TBB on par with Boost which is where it should be. Thank you.

This is not a technical issue. It's about perceived user quality and user friendliness. A library should not raise warnings and dump them on users to deal with.Now the warnings are suppressed where they should be, namely at the source, and not in the code of maybe thousands of TBB users.It may be true that these warnings issued by the Microsoft compiler aremeaningless, useless, dumband wrong. If Intel feels that waythe message should be sentto Microsoft.Tell Microsoft and not innocent users ofTBB.

Thanks again for this quality improvement of TBB.

.

0 Kudos
Alexey-Kukanov
Employee
335 Views

Quoting - uj
> If Intel feels that way the message should be sent to Microsoft, tell Microsoft and not innocent users of TBB.

I'm afraid they won't much listen to a single voice. I am not in better position to influence MS than you are. If there is a lot of user voices, however, it becomes louder and they more likely will listen.

I agree this is all about perceived quality (and not real quality); my point is just that /W4 is not an appropriate criteria. But I won't start another argue on that; no chance for any of us to change the point of view.

0 Kudos
uj
Beginner
335 Views

Quoting - uj
> If Intel feels that way the message should be sent to Microsoft, tell Microsoft and not innocent users of TBB.

I'm afraid they won't much listen to a single voice. I am not in better position to influence MS than you are. If there is a lot of user voices, however, it becomes louder and they more likely will listen.

I agree this is all about perceived quality (and not real quality); my point is just that /W4 is not an appropriate criteria. But I won't start another argue on that; no chance for any of us to change the point of view.


Maybe no you personallybut perhaps Intel could (influence Microsoft)?

Anyway, the good news is that you don't have to change your view regarding /W4. That's not the issue here. The issue is that TBB should not leak junk messages for usersto deal with. Those messages are directed at the developers ofTBB. To the users of TBB theye're totally meaningless and annoying.They could as well read "You're abig loser!" because there's nothing a TBB user can do with them apart from watching them or try to suppress them.

But I don't like /W4and therefore TBB users should suffer if they use /W4, you may say. I would buy that argument if it were Intel's official view. Intel would thentell Microsoft thatthey dislike /W4 to the point where they're going to use their own products to show how stupid /W4is. Then TBB would be free to leak as many /W4 warnings as it possibly could.

0 Kudos
Reply