- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Prompt please as correctly it is necessary to write
[bash]#pragma loop count (N)[/bash]Src or Src.
or it is necessary to write as it is specified in Intel C++ Compiler User & Reference Guides:
[bash]#pragma loop_count (N)[/bash]
Why so it is a lot of different interpretations?
Really developers from Intel do not use file WinDef.h or Windows.h where define ?
[bash]#ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif[/bash]because of what there is a conflict in #pragma:
[bash]#pragma loop_count min(n), max(n), avg(n)[/bash]Excuse me for my English.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"#pragma loop_count" is an Intel compiler specific pragma, and I would suggest that you use what is documented in the product documentation.
As for the "conflict" with Windows.h, I assume that you are referring to the following warning:
>>>t.c(13): warning #54: too few arguments in macro invocation #pragma loop count min(3), max(10), avg(5)
>>>t.c(13) : warning C4068: unknown pragma t.c(13) : warning C4003: not enough actual parameters for macro 'min'
>>>t.c(13) : warning C4003: not enough actual parameters for macro 'max'
This warning warns the users that min, max, avg when use in this context (with #pragma loop_count) has a different meaning than what is provided in Windows.h You can disable this warning with the option /Qwd54, where the number 54 refers to the identifier of the warning.
Note that Microsoft gives you a similar warnings:
>>>t.c(13) : warning C4068: unknown pragma t.c(13) : warning C4003: not enough actual parameters for macro 'min'
>>>t.c(13) : warning C4003: not enough actual parameters for macro 'max'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"#pragma loop_count" is an Intel compiler specific pragma, and I would suggest that you use what is documented in the product documentation.
As for the "conflict" with Windows.h, I assume that you are referring to the following warning:
>>>t.c(13): warning #54: too few arguments in macro invocation #pragma loop count min(3), max(10), avg(5)
>>>t.c(13) : warning C4068: unknown pragma t.c(13) : warning C4003: not enough actual parameters for macro 'min'
>>>t.c(13) : warning C4003: not enough actual parameters for macro 'max'
This warning warns the users that min, max, avg when use in this context (with #pragma loop_count) has a different meaning than what is provided in Windows.h You can disable this warning with the option /Qwd54, where the number 54 refers to the identifier of the warning.
Note that Microsoft gives you a similar warnings:
>>>t.c(13) : warning C4068: unknown pragma t.c(13) : warning C4003: not enough actual parameters for macro 'min'
>>>t.c(13) : warning C4003: not enough actual parameters for macro 'max'
though I am trying ICC 13.0 (beta ATM), but I feel this case doesn't matter.
I have eliminated warning by "/Qwd54" as you suggested.
My question is: When "min", "max" and "avg" are macros from Microsoft's headers, will ICC honour this pragma anyaway?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
it's true that both min(...) and max(...) are defined macros inherited by inclusion of "windows.h" ("WinDef.h" to be precise).
This means that the pre-processor will substitute all occurrences of both min(...) and max(...) before invoking the compiler. Hence, if you write something like that:
[cpp]#include... #pragma loop_count min(10), max(100), avg(25)[/cpp]
...the preprocessor will generate this:
[cpp]#pragma loop_count (((10) < ()) ? (10) : ()), (((100) > ()) ? (100) : ()), avg(25)[/cpp]
This is definitely not what you want. On Linux*/Mac OS* X you won't have this problem, by the way.
The correct solution is to use the alternative syntax:
[cpp]#pragma loop_count min=10, max=100, avg=25[/cpp]
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Really developers from Intel do not use file WinDef.h or Windows.h where define ?
- #ifndefmax
- #definemax(a,b)(((a)>(b))?(a):(b))
- #endif
- #ifndefmin
- #definemin(a,b)(((a)<(b))?(a):(b))
- #endif
[bash]#ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif[/bash]...
Problems with 'min' and 'max' macros are very old anda couple of years ago I decided to stop using these
macros. On a project I'm currently working two new macros are used instead, like:
#define CrtMin ...
and
#define CrtMax ...
They finally isolated codes from oldissues with classically defined macros.
Best regards,
Sergey

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page