Changeset 33e22da for doc/generic_types


Ignore:
Timestamp:
Apr 17, 2017, 7:58:50 AM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
2183e12, c87cd93
Parents:
02d241f
Message:

adjust green colour

Location:
doc/generic_types
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/acmart.cls

    r02d241f r33e22da  
    401401       \immediate\write\@auxout{\string\bibstyle{#1}}%
    402402     \fi}}
    403 \RequirePackage{graphicx, xcolor}
    404 \definecolor[named]{ACMBlue}{cmyk}{1,0.1,0,0.1}
    405 \definecolor[named]{ACMYellow}{cmyk}{0,0.16,1,0}
    406 \definecolor[named]{ACMOrange}{cmyk}{0,0.42,1,0.01}
    407 \definecolor[named]{ACMRed}{cmyk}{0,0.90,0.86,0}
    408 \definecolor[named]{ACMLightBlue}{cmyk}{0.49,0.01,0,0}
    409 \definecolor[named]{ACMGreen}{cmyk}{0.20,0,1,0.19}
    410 \definecolor[named]{ACMPurple}{cmyk}{0.55,1,0,0.15}
    411 \definecolor[named]{ACMDarkBlue}{cmyk}{1,0.58,0,0.21}
     403%\RequirePackage{graphicx, xcolor}
     404%\definecolor[named]{ACMBlue}{cmyk}{1,0.1,0,0.1}
     405%\definecolor[named]{ACMYellow}{cmyk}{0,0.16,1,0}
     406%\definecolor[named]{ACMOrange}{cmyk}{0,0.42,1,0.01}
     407%\definecolor[named]{ACMRed}{cmyk}{0,0.90,0.86,0}
     408%\definecolor[named]{ACMLightBlue}{cmyk}{0.49,0.01,0,0}
     409%\definecolor[named]{ACMGreen}{cmyk}{0.20,0,1,0.19}
     410%\definecolor[named]{ACMPurple}{cmyk}{0.55,1,0,0.15}
     411%\definecolor[named]{ACMDarkBlue}{cmyk}{1,0.58,0,0.21}
    412412\RequirePackage{geometry}
    413413\ifcase\ACM@format@nr
  • doc/generic_types/generic_types.tex

    r02d241f r33e22da  
    66\usepackage{upquote}                                                                    % switch curled `'" to straight
    77\usepackage{listings}                                                                   % format program code
     8\usepackage[usenames]{color}
    89
    910\makeatletter
     
    244245        return (T *)bsearch( &key, arr, size, sizeof(T), comp ); }
    245246forall( otype T | { int ?<?( T, T ); } ) unsigned int bsearch( T key, const T * arr, size_t size ) {
    246         T *result = bsearch( key, arr, size );  $\C{// call first version}$
     247        T * result = bsearch( key, arr, size ); $\C{// call first version}$
    247248        return result ? result - arr : size; }  $\C{// pointer subtraction includes sizeof(T)}$
    248249double * val = bsearch( 5.0, vals, 10 );        $\C{// selection based on return type}$
     
    356357% struct list {
    357358%     int value;
    358 %     list *next;                                                               $\C{// may omit "struct" on type names as in \CC}$
     359%     list * next;                                                              $\C{// may omit "struct" on type names as in \CC}$
    359360% };
    360 % typedef list *list_iterator;
     361% typedef list * list_iterator;
    361362%
    362363% lvalue int *?( list_iterator it ) { return it->value; }
     
    388389};
    389390forall( otype T ) T value( pair( const char *, T ) p ) { return p.second; }
    390 forall( dtype F, otype T ) T value_p( pair( F *, T * ) p ) { return *p.second; }
     391forall( dtype F, otype T ) T value_p( pair( F *, T * ) p ) { return * p.second; }
    391392pair( const char *, int ) p = { "magic", 42 };
    392393int magic = value( p );
     
    549550The type-resolver only has the tuple return-types to resolve the call to @bar@ as the @foo@ parameters are identical, which involves unifying the possible @foo@ functions with @bar@'s parameter list.
    550551No combination of @foo@s are an exact match with @bar@'s parameters, so the resolver applies C conversions.
    551 The minimal cost is @bar( foo@$_1$@( 3 ), foo@$_2$@( 3 ) )@, giving (@int@, {\color{green}@int@}, @double@) to (@int@, {\color{green}@double@}, @double@) with one {\color{green}safe} (widening) conversion from @int@ to @double@ versus ({\color{red}@double@}, {\color{green}@int@}, {\color{green}@int@}) to ({\color{red}@int@}, {\color{green}@double@}, {\color{green}@double@}) with one {\color{red}unsafe} (narrowing) conversion from @double@ to @int@ and two safe conversions.
     552The minimal cost is @bar( foo@$_1$@( 3 ), foo@$_2$@( 3 ) )@, giving (@int@, {\color{ForestGreen}@int@}, @double@) to (@int@, {\color{ForestGreen}@double@}, @double@) with one {\color{ForestGreen}safe} (widening) conversion from @int@ to @double@ versus ({\color{red}@double@}, {\color{ForestGreen}@int@}, {\color{ForestGreen}@int@}) to ({\color{red}@int@}, {\color{ForestGreen}@double@}, {\color{ForestGreen}@double@}) with one {\color{red}unsafe} (narrowing) conversion from @double@ to @int@ and two safe conversions.
    552553
    553554
     
    963964\begin{figure}
    964965\begin{lstlisting}[xleftmargin=3\parindentlnth,aboveskip=0pt,belowskip=0pt]
    965 int main( int argc, char *argv[] ) {
     966int main( int argc, char * argv[] ) {
    966967        FILE * out = fopen( "cfa-out.txt", "w" );
    967968        int max = 0, vali = 42;
     
    11021103
    11031104
    1104 \section{Conclusion \& Future Work}
     1105\section{Conclusion and Future Work}
    11051106
    11061107The goal of \CFA is to provide an evolutionary pathway for large C development-environments to be more productive and safer, while respecting the talent and skill of C programmers.
Note: See TracChangeset for help on using the changeset viewer.