Click here to Skip to main content
12,251,889 members (59,528 online)

C / C++ / MFC

 
QuestionHow to count pages in PDF file using VC++ Pin
shanmugarajaa23-Dec-12 18:00
membershanmugarajaa23-Dec-12 18:00 
AnswerRe: How to count pages in PDF file using VC++ Pin
Richard MacCutchan23-Dec-12 22:04
mvpRichard MacCutchan23-Dec-12 22:04 
AnswerRe: How to count pages in PDF file using VC++ Pin
Jijo.Raj26-Dec-12 23:29
memberJijo.Raj26-Dec-12 23:29 
QuestionHow to implement C++ raw string literals in VIsual C++ 2010? Pin
Falconapollo22-Dec-12 18:03
memberFalconapollo22-Dec-12 18:03 
As you may already know, new string literals in C++ 11 can be expressed in a very flexible way.

R"..."; - in this code the can be pretty much everything and also no escape characters are needed. Any kind of parentheses can be used to delimit the end of string, Raw string literals are especially useful when defining regular expressions:

R"(I love those who yearn for the impossible. (Von Goethe, "Faust"))";

Blocks of text can be simply defined using equal occurrences of same characters:

R";***************************( ; TINY BASIC FOR INTEL 8080
; VERSION 2.0
; BY LI-CHEN WANG
; MODIFIED AND TRANSLATED
; TO INTEL MNEMONICS
; BY ROGER RAUSKOLB
; 10 OCTOBER, 1976
; @COPYLEFT
; ALL WRONGS RESERVED ) ;***************************";


More information can be found here http://en.wikipedia.org/wiki/C++0x#New_string_literals[^] (Wikipedia).

I want to implement it with C++ processor, here is what I have. Now double quotation marks are not supported, and I need to compete it like C++ 11. Can anyone help me?

#define STR(a) #a
#define R(var, re)  static char var##_[] = STR(re);\
const char * var = ( var##_[ sizeof(var##_) - 2] = '\0',  (var##_ + 1) );

You can use it like this:

R(re, "\w\d");//It's OK, no warnings.

The code is not friendly to use. So I want the feature like C++ 11 raw string literals.

PS: I'm using Visual C++ 2010, the new feature is not supported, I must implement it by myself.
Questionproblems returning/printing poiner Pin
doughyi8u20-Dec-12 14:16
memberdoughyi8u20-Dec-12 14:16 
AnswerRe: problems returning/printing poiner Pin
Jochen Arndt20-Dec-12 21:15
memberJochen Arndt20-Dec-12 21:15 
AnswerRe: problems returning/printing poiner Pin
Richard MacCutchan20-Dec-12 22:47
mvpRichard MacCutchan20-Dec-12 22:47 
GeneralRe: problems returning/printing poiner Pin
Jochen Arndt20-Dec-12 23:07
memberJochen Arndt20-Dec-12 23:07 
GeneralRe: problems returning/printing poiner Pin
Richard MacCutchan21-Dec-12 0:19
mvpRichard MacCutchan21-Dec-12 0:19 
QuestionC++ ownerdrawfixed combobox "header" Pin
NoviceEx19-Dec-12 2:49
memberNoviceEx19-Dec-12 2:49 

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.


Advertise | Privacy | Mobile
Web01 | 2.8.160426.1 | Last Updated 5 May 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid