Click here to Skip to main content
15,891,184 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reading strings from ID3 tag Pin
Danzy8315-Oct-10 7:26
Danzy8315-Oct-10 7:26 
GeneralRe: Reading strings from ID3 tag Pin
Code-o-mat15-Oct-10 9:46
Code-o-mat15-Oct-10 9:46 
GeneralRe: Reading strings from ID3 tag Pin
Danzy8315-Oct-10 11:25
Danzy8315-Oct-10 11:25 
GeneralRe: Reading strings from ID3 tag Pin
Code-o-mat15-Oct-10 11:39
Code-o-mat15-Oct-10 11:39 
QuestionType Casting Pin
gothic_coder15-Oct-10 1:00
gothic_coder15-Oct-10 1:00 
AnswerRe: Type Casting Pin
Cedric Moonen15-Oct-10 1:02
Cedric Moonen15-Oct-10 1:02 
GeneralRe: Type Casting Pin
gothic_coder15-Oct-10 1:06
gothic_coder15-Oct-10 1:06 
AnswerRe: Type Casting Pin
Sauro Viti15-Oct-10 1:15
professionalSauro Viti15-Oct-10 1:15 
static_cast and reinterpret_cast work in the same way than the classic C-style cast, but they are used in two different context:

  • static_cast is used when casting between two related types, for instance from a numeric type to another. The conversion could generate a loss of data, but without the cast operator the code compile; the compiler could generate a warning.
    C++
    char a, b;
    int x = 123;
    double y = 123.456;
    a = static_cast<char>(x); // From int to char
    b = static_cast<char>(y); // From double to char
  • reinpterpret_cast is used when casting between two unrelated types, usually pointers, for instance from a pointer to a struct to a pointer to char. Without the cast operator the code doesn't compile; the compiler generate an error.
    C++
    POINT pt = { 10, 21 };
    unsigned char *pb = reinterpret_cast<unsigned char *>(&pt);
    // Print to screen the content of the structure in raw format
    for(int i = 0; i < sizeof(POINT); i++)
       printf("%02X  ", pb[i]);


Finally, dynamic_cast is a polymorphic cast operator; it's used only with pointers, and its main property is that if the conversion is possible it return the pointer value, otherwise it returns NULL. It's useful when working with inheritance.
QuestionOne genneral question on dual buffers design with multi-threading Pin
SAMZC14-Oct-10 23:42
SAMZC14-Oct-10 23:42 
AnswerRe: One genneral question on dual buffers design with multi-threading Pin
CPallini14-Oct-10 23:49
mveCPallini14-Oct-10 23:49 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
Rajesh R Subramanian15-Oct-10 1:01
professionalRajesh R Subramanian15-Oct-10 1:01 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
CPallini15-Oct-10 2:35
mveCPallini15-Oct-10 2:35 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
Rajesh R Subramanian15-Oct-10 22:10
professionalRajesh R Subramanian15-Oct-10 22:10 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC15-Oct-10 23:42
SAMZC15-Oct-10 23:42 
AnswerRe: One genneral question on dual buffers design with multi-threading Pin
Cedric Moonen14-Oct-10 23:55
Cedric Moonen14-Oct-10 23:55 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC15-Oct-10 20:37
SAMZC15-Oct-10 20:37 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
Rick York18-Oct-10 7:11
mveRick York18-Oct-10 7:11 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC18-Oct-10 18:22
SAMZC18-Oct-10 18:22 
AnswerRe: One genneral question on dual buffers design with multi-threading Pin
Rajesh R Subramanian15-Oct-10 1:05
professionalRajesh R Subramanian15-Oct-10 1:05 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC15-Oct-10 20:53
SAMZC15-Oct-10 20:53 
AnswerRe: One genneral question on dual buffers design with multi-threading Pin
federico.strati15-Oct-10 1:40
federico.strati15-Oct-10 1:40 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC15-Oct-10 20:51
SAMZC15-Oct-10 20:51 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZCN15-Oct-10 23:31
SAMZCN15-Oct-10 23:31 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
federico.strati17-Oct-10 20:45
federico.strati17-Oct-10 20:45 
GeneralRe: One genneral question on dual buffers design with multi-threading Pin
SAMZC16-Oct-10 7:57
SAMZC16-Oct-10 7:57 

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.