Click here to Skip to main content
15,889,116 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: back ground color of Message Box Pin
ThatsAlok3-Aug-08 21:30
ThatsAlok3-Aug-08 21:30 
GeneralRe: back ground color of Message Box Pin
Y_Kaushik3-Aug-08 21:39
Y_Kaushik3-Aug-08 21:39 
GeneralRe: back ground color of Message Box Pin
ThatsAlok3-Aug-08 22:34
ThatsAlok3-Aug-08 22:34 
GeneralRe: back ground color of Message Box Pin
ThatsAlok3-Aug-08 22:34
ThatsAlok3-Aug-08 22:34 
GeneralRe: back ground color of Message Box Pin
Y_Kaushik3-Aug-08 23:24
Y_Kaushik3-Aug-08 23:24 
GeneralRe: back ground color of Message Box Pin
ThatsAlok3-Aug-08 23:35
ThatsAlok3-Aug-08 23:35 
AnswerRe: back ground color of Message Box Pin
bolivar1234-Aug-08 4:49
bolivar1234-Aug-08 4:49 
QuestionInlining Question Pin
Leslie Sanford3-Aug-08 19:36
Leslie Sanford3-Aug-08 19:36 
I want to define a set of constants without using macros. I'd like to determine whether these constants are floats or doubles at compile time. So I'm using templates. In my header file, I have this:

template<bool DoublePrecision>
struct Constants
{
    typedef double SampleType;
 
    static const double pi;
    static const double piDoubled;
    static const double SampleRateDefault;
    static const double DenormalOffset;
};
 
template<>
struct Constants<false>
{
    typedef float SampleType;
 
    static const float pi;
    static const float piDoubled;
    static const float SampleRateDefault;
    static const float DenormalOffset;
};


In my implementation file, I have this:

#include "Constants.h"

const double Constants<true>::pi = 3.14159265358979;
const double Constants<true>::piDoubled = Constants<true>::pi * 2.0;
const double Constants<true>::SampleRateDefault = 44100.0;
const double Constants<true>::DenormalOffset = 1.0E-25;

const float Constants<false>::pi = 3.141593f;
const float Constants<false>::piDoubled = 6.283185f;
const float Constants<false>::SampleRateDefault = 44100.0f;
const float Constants<false>::DenormalOffset = 1.0E-25f;


All of this compiles fine.

My question is whether the values definined here will ultimately be inlined by the compiler where they are used. They are definined in one compilation unit but will be used in other compilation units. Will this prevent them from being inlined? In other words, will this ultimately be less efficient than using macros?
AnswerRe: Inlining Question Pin
vikas amin4-Aug-08 7:46
vikas amin4-Aug-08 7:46 
AnswerRe: Inlining Question Pin
not_in_use5-Aug-08 11:58
not_in_use5-Aug-08 11:58 
QuestionError: Message too long Pin
vikramaditya2343-Aug-08 19:32
vikramaditya2343-Aug-08 19:32 
QuestionRe: Error: Message too long Pin
David Crow4-Aug-08 3:11
David Crow4-Aug-08 3:11 
QuestionStrange problem about IOCP Pin
zengkun1003-Aug-08 16:43
zengkun1003-Aug-08 16:43 
QuestionIs there any tools or add-ins to help refactor the codes in vc6? Pin
fantasy12153-Aug-08 15:04
fantasy12153-Aug-08 15:04 
AnswerRe: Is there any tools or add-ins to help refactor the codes in vc6? Pin
bolivar1233-Aug-08 16:18
bolivar1233-Aug-08 16:18 
QuestionRe: Is there any tools or add-ins to help refactor the codes in vc6? Pin
fantasy12153-Aug-08 16:39
fantasy12153-Aug-08 16:39 
GeneralRe: Is there any tools or add-ins to help refactor the codes in vc6? Pin
fantasy12153-Aug-08 17:00
fantasy12153-Aug-08 17:00 
QuestionCreating a dos driver? [modified] Pin
Sauce!3-Aug-08 12:57
Sauce!3-Aug-08 12:57 
AnswerRe: Creating a dos driver? Pin
Sauce!5-Aug-08 20:59
Sauce!5-Aug-08 20:59 
QuestionStarting Windows mobile C++ Development Pin
Jamie Nordmeyer3-Aug-08 12:49
Jamie Nordmeyer3-Aug-08 12:49 
AnswerRe: Starting Windows mobile C++ Development Pin
Garth J Lancaster3-Aug-08 20:05
professionalGarth J Lancaster3-Aug-08 20:05 
QuestionProgress indicator in dialog title Pin
philrk3-Aug-08 11:00
philrk3-Aug-08 11:00 
AnswerRe: Progress indicator in dialog title Pin
Mark Salsbery4-Aug-08 7:51
Mark Salsbery4-Aug-08 7:51 
QuestionCreatefile in Vista Pin
RaymondM3-Aug-08 2:32
RaymondM3-Aug-08 2:32 
AnswerRe: Createfile in Vista Pin
Perspx3-Aug-08 2:55
Perspx3-Aug-08 2:55 

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.