Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/user_literals.c

    reb68ebb rf47ba55  
    1010// Created On       : Wed Sep  6 21:40:50 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep  7 22:53:49 2017
    13 // Update Count     : 39
     12// Last Modified On : Wed Sep  6 23:19:08 2017
     13// Update Count     : 36
    1414//
    1515
    1616#include <fstream>
    17 #include <wchar.h>
    18 #include <uchar.h>
    19 
    20 int ?`s( int s ) { sout | "secs" | s | endl; }
    21 int ?`m( int m ) { sout | "mins" | m | endl; }
    22 int ?`h( int h ) { sout | "hours" | h | endl; }
    23 int ?`_A_( int x ) { sout | "_A_" | x | endl; }
    24 int ?`__thingy_( int x ) { sout | "_thingy_" | x | endl; }
    25 
    26 int ?`s( const char * s ) { sout | "secs" | s | endl; }
    27 int ?`m( const char16_t * m ) { sout | "mins" | m | endl; }
    28 int ?`h( const char32_t * h ) { sout | "hours" | h | endl; }
    29 int ?`_A_( const wchar_t * x ) { sout | "_A_" | x | endl; }
    30 int ?`__thingy_( const char * x ) { sout | "_thingy_" | x | endl; }
    31 
    3217
    3318struct Weight {
     
    4328Weight ?`lb( double w ) { return (Weight){ w / 14.0 }; }
    4429Weight ?`kg( double w ) { return (Weight) { w * 0.1575}; }
    45 
    4630
    4731int main() {
     
    5943    w = 5`st + 8`kg + 25`lb + hw;
    6044    sout | w | endl;
     45}
    6146
    62 //      0`secs;
    63         1`s;
    64         23`s;
    65         23u`m;
    66         23l`h;
    67         23_ul`_A_;
    68         1_234_LL`__thingy_;
    6947
    70         0xff_ffl;
    71         0xff_ff`s;
    72         0xff_ffu`m;
    73         0xff_ffl`h;
    74         0xff_fful`_A_;
    75         0xff_ffLL`__thingy_;
    76 
    77     '\n'`s;
    78     L'\n'`h;
    79     u'\n'`m;
    80     L_'\n'`_A_;
    81     U_'\n'`__thingy_;
    82 
    83         "abc"`s;
    84         u"abc"`m;
    85         U_"abc"`h;
    86         L"abc"`_A_;
    87         u8_"abc"`__thingy_;
    88 } // main
    8948
    9049// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.