Click here to Skip to main content
15,920,109 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need Source Code for Decoding _Using algorithm Pin
leon de boer21-Jun-17 3:11
leon de boer21-Jun-17 3:11 
GeneralRe: Need Source Code for Decoding _Using algorithm Pin
Member 1326117521-Jun-17 18:17
Member 1326117521-Jun-17 18:17 
GeneralRe: Need Source Code for Decoding _Using algorithm Pin
Member 1326117522-Jun-17 2:00
Member 1326117522-Jun-17 2:00 
GeneralRe: Need Source Code for Decoding _Using algorithm Pin
leon de boer22-Jun-17 10:31
leon de boer22-Jun-17 10:31 
QuestionLocal / unique Variable Macro question Pin
ForNow18-Jun-17 8:44
ForNow18-Jun-17 8:44 
AnswerRe: Local / unique Variable Macro question Pin
Iain Clarke, Warrior Programmer18-Jun-17 20:36
Iain Clarke, Warrior Programmer18-Jun-17 20:36 
SuggestionRe: Local / unique Variable Macro question Pin
Jochen Arndt18-Jun-17 21:42
professionalJochen Arndt18-Jun-17 21:42 
AnswerRe: Local / unique Variable Macro question Pin
leon de boer19-Jun-17 3:40
leon de boer19-Jun-17 3:40 
+10 to Jochen's answer
Complex Macros are evil and usually cause problems down the track, avoid them.
If you are really sensitive inline the code but realistically all modern compilers like GCC and VC++ will inline anything you spot anyhow. They also have setting to control the behaviour.

On GCC -O2 will inline blocks that a heuristic analysis code determines is worth it and results in smaller code. With -O3 will inline blocks that the heuristic analysis code determines is worth it regardless of size.
It also has an attribute to add to a code block __attribute__((always_inline)) which will force an inline whenever used.

In VC++ the setting is under optimization control called "Inline function Expansion", the setting "any suitable" will allow the compiler to inline any code it decides is worth it.
VC++ carries __forceinline as it's attribute to force a block to be inlined.

I will almost guarantee you that your code using the MACRO will be slower than what the compiler works out by you just writing a normal C/C++ function and letting the optimizer do it's thing Smile | :)

It seems to get lost on the net that the modern compilers are a far cry from the old ones. You get better results by trying to help the optimizer rather than fighting it.
In vino veritas

GeneralRe: Local / unique Variable Macro question Pin
ForNow19-Jun-17 3:55
ForNow19-Jun-17 3:55 
GeneralRe: Local / unique Variable Macro question Pin
leon de boer19-Jun-17 5:14
leon de boer19-Jun-17 5:14 
GeneralRe: Local / unique Variable Macro question Pin
ForNow19-Jun-17 5:52
ForNow19-Jun-17 5:52 
GeneralRe: Local / unique Variable Macro question Pin
leon de boer19-Jun-17 9:16
leon de boer19-Jun-17 9:16 
AnswerRe: Local / unique Variable Macro question Pin
Bram van Kampen28-Jun-17 13:21
Bram van Kampen28-Jun-17 13:21 
GeneralRe: Local / unique Variable Macro question Pin
ForNow28-Jun-17 13:47
ForNow28-Jun-17 13:47 
GeneralRe: Local / unique Variable Macro question Pin
Bram van Kampen28-Jun-17 14:21
Bram van Kampen28-Jun-17 14:21 
QuestionDisecting a PE File Pin
Bram van Kampen16-Jun-17 14:19
Bram van Kampen16-Jun-17 14:19 
AnswerRe: Disecting a PE File Pin
leon de boer17-Jun-17 3:17
leon de boer17-Jun-17 3:17 
GeneralRe: Disecting a PE File Pin
Bram van Kampen18-Jun-17 12:46
Bram van Kampen18-Jun-17 12:46 
GeneralRe: Disecting a PE File Pin
harold aptroot18-Jun-17 3:11
harold aptroot18-Jun-17 3:11 
GeneralRe: Disecting a PE File Pin
Bram van Kampen18-Jun-17 13:05
Bram van Kampen18-Jun-17 13:05 
GeneralRe: Disecting a PE File Pin
harold aptroot18-Jun-17 13:39
harold aptroot18-Jun-17 13:39 
GeneralRe: Disecting a PE File Pin
Bram van Kampen19-Jun-17 13:27
Bram van Kampen19-Jun-17 13:27 
GeneralRe: Disecting a PE File Pin
harold aptroot19-Jun-17 14:27
harold aptroot19-Jun-17 14:27 
GeneralRe: Disecting a PE File Pin
Richard MacCutchan19-Jun-17 20:57
mveRichard MacCutchan19-Jun-17 20:57 
GeneralRe: Disecting a PE File Pin
Bram van Kampen29-Jun-17 12:00
Bram van Kampen29-Jun-17 12:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.