Proposal of File String Literals    Document No.: Dnnnn  Project: Programming Language C++  Author: Andrew Tomazos <​ [email protected]​ >  Date: 2016­04­21 

Summary  We propose a new kind of string literal called a ​ file string literal.​   A file string literal is like a raw  string literal, except the content of the string is stored in a separate dedicated source file, rather  than in­line in the host source file.  The path of the file is specified, like an included header, as  part of the file string literal.  The content of the source file becomes the content of the string  literal, verbatim. 

Example  The content of datafile.txt:       The quick brown fox jumps over the lazy dog.    The content of main.cc:       #include      int main() {       std::cout << F”datafile.txt”;     }    The program outputs:       The quick brown fox jumps over the lazy dog. 

Wording  Modify [lex.phases]/4:    Preprocessing directives are executed, macro invocations are expanded, ​ file string literals are  replaced​ , and _Pragma unary operator expressions are executed.   

Add new section 16.10: 

16.10 File string literals                                                [cpp.filestrlit]     A token of of the form:               ​ encoding­prefix​  ​ F ​ " ​ ​ q­char­sequence ​ ​ "​ ​  ​ ud­suffix​ opt​ opt    is a ​ file string literal​ .  [Note: A file string literal holds the same content as the source file  identified by the ​ q­char­sequence.​  ­­end note]    A file string literal ​ EF”Q”U​ , where ​ E​  is the ​ encoding­prefix ​ (or an empty source character  sequence if not present), ​ Q​  is the ​ q­char­sequence,​  ​ U​  is the ​ ud­suffix ​ (or an empty source  character sequence if not present) ­ is equivalent, by definition, to a preprocessing directive:       # include “​ Q​ ”    except that the contents of the included source file shall be augmented during replacement in  the following manner:  Let ​ C​  be the would­be replaced content of the source file named by ​ Q​ .  Let ​ D​  be a valid ​ d­char­sequence ​ that does not appear in ​ C​ .  The file string literal shall be  replaced by the raw string literal ​ ER”D(C)D”U​ . 

Motivation  String literals are heavily used to compile­in sequences of text of some language (eg natural  language, declarative language, programming language) into C++ programs ­ that are then  either stored in the read­only section of the program image or even, newly, further interpreted  and processed during compilation using constexpr programming.    Raw string literals have become a popular kind of string literal to use when the sequence of text  is multi­line, because of their verbatim nature they don’t need to be obfuscated by using  preprocessor string literal concatenation and redundantly encoding newlines with “\n”.    Sometimes it is useful to dedicate a whole source file to effectively hold the content of a single  string literal.  Organizing a codebase using a filesystem of small source files is accepted good  practice as it is generally easier to navigate than scrolling through long source files.  Further,  having a dedicated source file for a string literal means that tools (for example language­aware  editors) can be used on that source file that know about the language of the string literal, but  don’t know about C++.   

There is currently no standard mechanism to dedicate a source file to a single string literal in  this manner.  There are a variety of non­standard mechanisms that are used.  These techniques  involve taking the original source file and then translating it into a generated C++ source file. For  simple examples there are tools like XPM, incbin, "xxd ­i".    These non­standard mechanisms suffer a lot of problems.  In particular they are difficult to use  and configure.  The build system needs to have novel configuration and then the name and  format of the generated header file needs to be determined.  This layer of indirection is  unnecessary.  A standard mechanism can perform the operation directly during translation  in a  simple portable way.    We propose a standard mechanism to achieve this task.  As can be seen in the proposed  wording the mechanism we propose simply combines two existing standard mechanisms,  source file inclusion​  and ​ raw string literals​ ,​  ​ to produce ​ file string literals​ .  The reuse of the  two existing mechanisms means the feature is very easy to understand and use, fits neatly into  the ecosystem, and is highly efficient because the translation of the dedicated source file into  the string literal takes place as part of normal translation.  We also get “for free” the  encoding­prefix and user­defined literal mechanisms, and the encoding rules about source files. 

References  https://groups.google.com/a/isocpp.org/forum/#!msg/std­proposals/b6ncBojU8wI/blx1GlLqUAUJ    https://groups.google.com/a/isocpp.org/forum/#!topic/std­proposals/CDbPC2YgiHE   

Proposal of File String Literals -

string literal, except the content of the string is stored in a separate dedicated source file, rather than inline in the host source file. The path of the file is specified, ...

148KB Sizes 0 Downloads 157 Views

Recommend Documents

Numeric Literals Strings Boolean constants Boolean ... - GitHub
iRODS Rule Language Cheat Sheet. iRODS Version 4.0.3. Author: Samuel Lampa, BILS. Numeric Literals. 1 # integer. 1.0 # double. Strings. Concatenation:.

Practical String Dictionary Compression Using String ...
Abstract—A string dictionary is a data structure for storing a set of strings that maps them ..... been proposed [9], [10] and implemented as open-source software, such as the .... ENWIKI: All page titles from English Wikipedia in. February 2015.9.

String of Diamonds Runner.pdf
Page 1 of 2. Cutting Directions. Patch 1st cut 2nd cut. A 7 4-3/4” squares. B 14 3-7/8” squares Cut diagonally. into 28 HSTs. C 22 2” x 6 1⁄2”. D 16 2” squares. Fabric Yardage. A 1/4 yard. B 1/4 yard. C 1/4 yard. D 1/8 yard. Fabric requir

String of Diamonds Runner.pdf
Fabric Yardage. A 1/4 yard. B 1/4 yard. C 1/4 yard. D 1/8 yard. Fabric requirements. (Does not include backing or. binding). String of Diamonds Runner. A. B. C.

INTRODUCTION to STRING FIELD THEORY
http://insti.physics.sunysb.edu/˜siegel/plan.html ... 1.3. Aspects. 4. 1.4. Outline. 6. 2. General light cone. 2.1. Actions. 8. 2.2. Conformal algebra. 10. 2.3. Poincaré ...

Panel Proposal
Choose an option. ( ) Member of SAAS ( ) Member of ASA ( ) Processing Membership. Title of Proposed panel: Panel Abstract (200-300 words): Please, complete this form and send it, in electronic format (via e-mail), to board members. Rodrigo Andrés (r

String Orchestra Competencies.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

A proposal of charact
The term has been adopted by early computer graphics for indicating the goal of accurately ..... Virtual reality devices and computer sciences have impressively developed ... London and Edinburgh ... Oxford: Oxford University Press. Gibson ...

Optimization of String Matching Algorithm on GPU
times faster with significant improvement on memory efficiency. Furthermore, because the ... become inadequate for the high-speed network. To accelerate string ...

Approval of Proposal Defense Committee.pdf
Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Approval of Proposal Defense Committee.pdf. Approval of Proposal Defense Committee.pdf. Open. Extract. Open with. Sign In. Main menu. Whoops! There was a

PROPOSAL SOLICITATION: PATIENT SAFETY CENTERS OF INQUIRY
to compete to become a Patient Safety Center of Inquiry (PSCI). Patient Safety .... 2016; however, the call for PSCI travel requests is unlikely to be released prior ...

Structure of MBA Thesis Research Proposal
Hypotheses are relatively easy to test if your research study is more or less quantitative in nature and if you wish ... What are the best practices in the world and how do they relate to your research issue? ... main data analysis methods and why yo

CITY OF MOBILE, ALABAMA REQUEST FOR PROPOSAL ...
Apr 30, 2016 - State company name and all contact information including the name, ... and became disabled prior to age 19 while covered by the City of.

The 101 string
BOOK OF REVELATION PDF.Lion king nordic.The 101 string.489370793077. ... Alvin and thechipmunk 2. Gawain green knight.Sugar Meets UncleJesse.

SASE-Submitting-a-Proposal
Log into your account at sase.org – green button “sign in” in the top right-hand corner of the homepage: ... Once you are logged in, you will see the green button “submit a paper” in the top right-hand corner of any page on the ... Conferen

venue proposal -
Coke and Still Mineral Water. Unlimited and bottled. 1.5 Pricing. Original Menu (Less the lamb and chicken karahi, veg curry and naan) is £15.95 per head.

Request for Proposal - Ning
Sep 3, 2013 - Synopsis: Enhancing Mobile Populations' Access to HIV and AIDS Services, Information and. Support a 5 year project funded by Big Lottery ...

proposal pdf.pdf
Page 1 of 6. UAL Awarding Body – Foundation. Unit 7- Project Proposal. Candidate. Number. Candidate. Number. Candidate Name Odysseus Miltiadous. Candidate. Number. 96519217. Pathway Graphic Design. Project Title Can we rely on the government to act

String Name Animals.pdf
Page 1 of 1. String Name Animals.pdf. String Name Animals.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying String Name Animals.pdf.

pre-proposal for finance wg guidelines for proposal -
OB will e recompensed between General Assemblies (GAs); and ... That the General Assembly (GA) authorize the FWG to open a checking account at WECU as ...

Build Your Own Search String - 21cLiteracies Wiki
#1 Terms and Strings. The words that you enter in the Google basic search box are called terms. As you look for information, try to use terms that are commonly used and that are absolutely essential to your research question. A group of terms is call

Build Your Own Search String - 21cLiteracies Wiki
Sometimes the best way to find information is to search for two or more ... Build Your Own. Search ... Using a site operator as a term in your search string will give.

Musical Applications of New, Multi-axis Guitar String ...
The development and application of new optical, piezoelectric and variable reluctance transducers is described for polyphonic stringed instruments especially.