Index: doc/user/user.tex
===================================================================
--- doc/user/user.tex	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ doc/user/user.tex	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -11,6 +11,6 @@
 %% Created On       : Wed Apr  6 14:53:29 2016
 %% Last Modified By : Peter A. Buhr
-%% Last Modified On : Fri May 19 11:54:31 2017
-%% Update Count     : 1735
+%% Last Modified On : Sun May 21 23:36:42 2017
+%% Update Count     : 1822
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -94,5 +94,5 @@
 \author{
 \huge \CFA Team \medskip \\
-\Large Richard Bilson, Peter A. Buhr, Thierry Delisle, \smallskip \\
+\Large Andrew Beach, Richard Bilson, Peter A. Buhr, Thierry Delisle, \smallskip \\
 \Large Glen Ditchfield, Rodolfo G. Esteves, Aaron Moss, Rob Schluntz
 }% author
@@ -644,13 +644,19 @@
 \end{quote2}
 
-Unsupported are K\&R C declarations where the base type defaults to ©int©, if no type is specified,\footnote{
-At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each structure declaration and type name~\cite[\S~6.7.2(2)]{C11}}
-\eg:
-\begin{cfa}
-x;								§\C{// int x}§
-*y;								§\C{// int *y}§
-f( p1, p2 );					§\C{// int f( int p1, int p2 );}§
-f( p1, p2 ) {}					§\C{// int f( int p1, int p2 ) {}}§
-\end{cfa}
+The new declaration syntax can be used in other contexts where types are required, \eg casts and the pseudo-routine ©sizeof©:
+\begin{quote2}
+\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
+\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}	& \multicolumn{1}{c}{\textbf{C}}	\\
+\begin{cfa}
+y = (®* int®)x;
+i = sizeof(®[ 5 ] * int®);
+\end{cfa}
+&
+\begin{cfa}
+y = (®int *®)x;
+i = sizeof(®int *[ 5 ]®);
+\end{cfa}
+\end{tabular}
+\end{quote2}
 
 Finally, new \CFA declarations may appear together with C declarations in the same program block, but cannot be mixed within a specific declaration.
@@ -1105,23 +1111,4 @@
 > already.
 \end{comment}
-
-
-\section{Type Operators}
-
-The new declaration syntax can be used in other contexts where types are required, \eg casts and the pseudo-routine ©sizeof©:
-\begin{quote2}
-\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
-\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}	& \multicolumn{1}{c}{\textbf{C}}	\\
-\begin{cfa}
-y = (®* int®)x;
-i = sizeof(®[ 5 ] * int®);
-\end{cfa}
-&
-\begin{cfa}
-y = (®int *®)x;
-i = sizeof(®int *[ 5 ]®);
-\end{cfa}
-\end{tabular}
-\end{quote2}
 
 
@@ -4842,164 +4829,41 @@
 
 
-\section{Syntactic Anomalies}
-
-There are several ambiguous cases with operator identifiers, \eg ©int *?*?()©, where the string ©*?*?© can be lexed as ©*©~\R{/}~©?*?© or ©*?©~\R{/}~©*?©.
-Since it is common practise to put a unary operator juxtaposed to an identifier, \eg ©*i©, users will be annoyed if they cannot do this with respect to operator identifiers.
-Even with this special hack, there are 5 general cases that cannot be handled.
-The first case is for the function-call identifier ©?()©:
-\begin{cfa}
-int *§\textvisiblespace§?()();	// declaration: space required after '*'
-*§\textvisiblespace§?()();		// expression: space required after '*'
-\end{cfa}
-Without the space, the string ©*?()© is ambiguous without N character look ahead;
-it requires scanning ahead to determine if there is a ©'('©, which is the start of an argument/parameter list.
-
-The 4 remaining cases occur in expressions:
-\begin{cfa}
-i++§\textvisiblespace§?i:0;		// space required before '?'
-i--§\textvisiblespace§?i:0;		// space required before '?'
-i§\textvisiblespace§?++i:0;		// space required after '?'
-i§\textvisiblespace§?--i:0;		// space required after '?'
-\end{cfa}
-In the first two cases, the string ©i++?© is ambiguous, where this string can be lexed as ©i© / ©++?© or ©i++© / ©?©;
-it requires scanning ahead to determine if there is a ©'('©, which is the start of an argument list.
-In the second two cases, the string ©?++x© is ambiguous, where this string can be lexed as ©?++© / ©x© or ©?© / y©++x©;
-it requires scanning ahead to determine if there is a ©'('©, which is the start of an argument list.
-
-
-\section{Incompatible}
-
-The following incompatibles exist between \CFA and C, and are similar to Annex C for \CC~\cite{C++14}.
-
-\begin{enumerate}
-\item
-\begin{description}
-\item[Change:] add new keywords \\
-New keywords are added to \CFA (see~\VRef{s:NewKeywords}).
-\item[Rationale:] keywords added to implement new semantics of \CFA.
-\item[Effect on original feature:] change to semantics of well-defined feature. \\
-Any ISO C programs using these keywords as identifiers are invalid \CFA programs.
-\item[Difficulty of converting:] keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism (see~\VRef{s:BackquoteIdentifiers}):
-\item[How widely used:] clashes among new \CFA keywords and existing identifiers are rare.
-\end{description}
-
-\item
-\begin{description}
-\item[Change:] type of character literal ©int© to ©char© to allow more intuitive overloading:
-\begin{cfa}
-int rtn( int i );
-int rtn( char c );
-rtn( 'x' );						§\C{// programmer expects 2nd rtn to be called}§
-\end{cfa}
-\item[Rationale:] it is more intuitive for the call to ©rtn© to match the second version of definition of ©rtn© rather than the first.
-In particular, output of ©char© variable now print a character rather than the decimal ASCII value of the character.
-\begin{cfa}
-sout | 'x' | " " | (int)'x' | endl;
-x 120
-\end{cfa}
-Having to cast ©'x'© to ©char© is non-intuitive.
-\item[Effect on original feature:] change to semantics of well-defined feature that depend on:
-\begin{cfa}
-sizeof( 'x' ) == sizeof( int )
-\end{cfa}
-no long work the same in \CFA programs.
-\item[Difficulty of converting:] simple
-\item[How widely used:] programs that depend upon ©sizeof( 'x' )© are rare and can be changed to ©sizeof(char)©.
-\end{description}
-
-\item
-\begin{description}
-\item[Change:] make string literals ©const©:
-\begin{cfa}
-char * p = "abc";				§\C{// valid in C, deprecated in \CFA}§
-char * q = expr ? "abc" : "de";	§\C{// valid in C, invalid in \CFA}§
-\end{cfa}
-The type of a string literal is changed from ©[] char© to ©const [] char©.
-Similarly, the type of a wide string literal is changed from ©[] wchar_t© to ©const [] wchar_t©.
-\item[Rationale:] This change is a safety issue:
-\begin{cfa}
-char * p = "abc";
-p[0] = 'w';						§\C{// segment fault or change constant literal}§
-\end{cfa}
-The same problem occurs when passing a string literal to a routine that changes its argument.
-\item[Effect on original feature:] change to semantics of well-defined feature.
-\item[Difficulty of converting:] simple syntactic transformation, because string literals can be converted to ©char *©.
-\item[How widely used:] programs that have a legitimate reason to treat string literals as pointers to potentially modifiable memory are rare.
-\end{description}
-
-\item
-\begin{description}
-\item[Change:] remove \newterm{tentative definitions}, which only occurs at file scope:
-\begin{cfa}
-int i;							§\C{// forward definition}§
-int *j = ®&i®;					§\C{// forward reference, valid in C, invalid in \CFA}§
-int i = 0;						§\C{// definition}§
-\end{cfa}
-is valid in C, and invalid in \CFA because duplicate overloaded object definitions at the same scope level are disallowed.
-This change makes it impossible to define mutually referential file-local static objects, if initializers are restricted to the syntactic forms of C. For example,
-\begin{cfa}
-struct X { int i; struct X *next; };
-static struct X a;				§\C{// forward definition}§
-static struct X b = { 0, ®&a® };	§\C{// forward reference, valid in C, invalid in \CFA}§
-static struct X a = { 1, &b };	§\C{// definition}§
-\end{cfa}
-\item[Rationale:] avoids having different initialization rules for builtin types and userdefined types.
-\item[Effect on original feature:] change to semantics of well-defined feature.
-\item[Difficulty of converting:] the initializer for one of a set of mutually-referential file-local static objects must invoke a routine call to achieve the initialization.
-\item[How widely used:] seldom
-\end{description}
-
-\item
-\begin{description}
-\item[Change:] have ©struct© introduce a scope for nested types:
-\begin{cfa}
-enum ®Colour® { R, G, B, Y, C, M };
-struct Person {
-	enum ®Colour® { R, G, B };	§\C{// nested type}§
-	struct Face {				§\C{// nested type}§
-		®Colour® Eyes, Hair;	§\C{// type defined outside (1 level)}§
-	};
-	ß.ß®Colour® shirt;			§\C{// type defined outside (top level)}§
-	®Colour® pants;				§\C{// type defined same level}§
-	Face looks[10];				§\C{// type defined same level}§
-};
-®Colour® c = R;					§\C{// type/enum defined same level}§
-Personß.ß®Colour® pc = Personß.ßR;	§\C{// type/enum defined inside}§
-Personß.ßFace pretty;			§\C{// type defined inside}§
-\end{cfa}
-In C, the name of the nested types belongs to the same scope as the name of the outermost enclosing structure, \ie the nested types are hoisted to the scope of the outer-most type, which is not useful and confusing.
-\CFA is C \emph{incompatible} on this issue, and provides semantics similar to \Index*[C++]{\CC}.
-Nested types are not hoisted and can be referenced using the field selection operator ``©.©'', unlike the \CC scope-resolution operator ``©::©''.
-\item[Rationale:] ©struct© scope is crucial to \CFA as an information structuring and hiding mechanism.
-\item[Effect on original feature:] change to semantics of well-defined feature.
-\item[Difficulty of converting:] Semantic transformation.
-\item[How widely used:] C programs rarely have nest types because they are equivalent to the hoisted version.
-\end{description}
-
-\item
-\begin{description}
-\item[Change:] In C++, the name of a nested class is local to its enclosing class.
-\item[Rationale:] C++ classes have member functions which require that classes establish scopes.
-\item[Difficulty of converting:] Semantic transformation. To make the struct type name visible in the scope of the enclosing struct, the struct tag could be declared in the scope of the enclosing struct, before the enclosing struct is defined. Example:
-\begin{cfa}
-struct Y;						§\C{// struct Y and struct X are at the same scope}§
-struct X {
-struct Y { /* ... */ } y;
-};
-\end{cfa}
-All the definitions of C struct types enclosed in other struct definitions and accessed outside the scope of the enclosing struct could be exported to the scope of the enclosing struct.
-Note: this is a consequence of the difference in scope rules, which is documented in 3.3.
-\item[How widely used:] Seldom.
-\end{description}
-
-\item
-\begin{description}
-\item[Change:] comma expression is disallowed as subscript
-\item[Rationale:] safety issue to prevent subscripting error for multidimensional arrays: ©x[i,j]© instead of ©x[i][j]©, and this syntactic form then taken by \CFA for new style arrays.
-\item[Effect on original feature:] change to semantics of well-defined feature.
-\item[Difficulty of converting:] semantic transformation of ©x[i,j]© to ©x[(i,j)]©
-\item[How widely used:] seldom.
-\end{description}
-\end{enumerate}
+\section{Syntax Ambiguities}
+
+C has a number of syntax ambiguities, which are resolved by taking the longest sequence of overlapping characters that constitute a token.
+For example, the program fragment ©x+++++y© is parsed as \lstinline[showspaces=true]@x ++ ++ + y@ because operator tokens ©++© and ©+© overlap.
+Unfortunately, the longest sequence violates a constraint on increment operators, even though the parse \lstinline[showspaces=true]@x ++ + ++ y@ might yield a correct expression.
+Hence, C programmers are aware that spaces have to added to disambiguate certain syntactic cases.
+
+In \CFA, there are ambiguous cases with dereference and operator identifiers, \eg ©int *?*?()©, where the string ©*?*?© can be interpreted as:
+\begin{cfa}
+*?§\color{red}\textvisiblespace§*?		§\C{// dereference operator, dereference operator}§
+*§\color{red}\textvisiblespace§?*?		§\C{// dereference, multiplication operator}§
+\end{cfa}
+By default, the first interpretation is selected, which does not yield a meaningful parse.
+Therefore, \CFA does a lexical look-ahead for the second case, and backtracks to return the leading unary operator and reparses the trailing operator identifier.
+Otherwise a space is needed between the unary operator and operator identifier to disambiguate this common case.
+
+A similar issue occurs with the dereference, ©*?(...)©, and routine-call, ©?()(...)© identifiers.
+The ambiguity occurs when the deference operator has no parameters:
+\begin{cfa}
+*?()§\color{red}\textvisiblespace...§ ;
+*?()§\color{red}\textvisiblespace...§(...) ;
+\end{cfa}
+requiring arbitrary whitespace look-ahead for the routine-call parameter-list to disambiguate.
+However, the dereference operator \emph{must} have a parameter/argument to dereference ©*?(...)©.
+Hence, always interpreting the string ©*?()© as \lstinline[showspaces=true]@* ?()@ does not preclude any meaningful program.
+
+The remaining cases are with the increment/decrement operators and conditional expression, \eg:
+\begin{cfa}
+i++?§\color{red}\textvisiblespace...§(...);
+i?++§\color{red}\textvisiblespace...§(...);
+\end{cfa}
+requiring arbitrary whitespace look-ahead for the operator parameter-list, even though that interpretation is an incorrect expression (juxtaposed identifiers).
+Therefore, it is necessary to disambiguate these cases with a space:
+\begin{cfa}
+i++§\color{red}\textvisiblespace§? i : 0;
+i?§\color{red}\textvisiblespace§++i : 0;
+\end{cfa}
 
 
@@ -5008,5 +4872,5 @@
 
 \begin{quote2}
-\begin{tabular}{lll}
+\begin{tabular}{llll}
 \begin{tabular}{@{}l@{}}
 ©_AT©			\\
@@ -5016,22 +4880,25 @@
 ©coroutine©		\\
 ©disable©		\\
-©dtype©			\\
-©enable©		\\
 \end{tabular}
 &
 \begin{tabular}{@{}l@{}}
+©dtype©			\\
+©enable©		\\
 ©fallthrough©	\\
 ©fallthru©		\\
 ©finally©		\\
 ©forall©		\\
+\end{tabular}
+&
+\begin{tabular}{@{}l@{}}
 ©ftype©			\\
 ©lvalue©		\\
 ©monitor©		\\
 ©mutex©			\\
+©one_t©			\\
+©otype©			\\
 \end{tabular}
 &
 \begin{tabular}{@{}l@{}}
-©one_t©			\\
-©otype©			\\
 ©throw©			\\
 ©throwResume©	\\
@@ -5043,4 +4910,168 @@
 \end{tabular}
 \end{quote2}
+
+
+\section{Incompatible}
+
+The following incompatibles exist between \CFA and C, and are similar to Annex C for \CC~\cite{C++14}.
+
+
+\begin{enumerate}
+\item
+\begin{description}
+\item[Change:] add new keywords \\
+New keywords are added to \CFA (see~\VRef{s:CFAKeywords}).
+\item[Rationale:] keywords added to implement new semantics of \CFA.
+\item[Effect on original feature:] change to semantics of well-defined feature. \\
+Any ISO C programs using these keywords as identifiers are invalid \CFA programs.
+\item[Difficulty of converting:] keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism (see~\VRef{s:BackquoteIdentifiers}).
+\item[How widely used:] clashes among new \CFA keywords and existing identifiers are rare.
+\end{description}
+
+\item
+\begin{description}
+\item[Change:] drop K\&R C declarations \\
+K\&R declarations allow an implicit base-type of ©int©, if no type is specified, plus an alternate syntax for declaring parameters.
+\eg:
+\begin{cfa}
+x;								§\C{// int x}§
+*y;								§\C{// int *y}§
+f( p1, p2 );					§\C{// int f( int p1, int p2 );}§
+g( p1, p2 ) int p1, p2;			§\C{// int g( int p1, int p2 );}§
+\end{cfa}
+\CFA supports K\&R routine definitions:
+\begin{cfa}
+f( a, b, c )					§\C{// default int return}§
+	int a, b; char c			§\C{// K\&R parameter declarations}§
+{
+	...
+}
+\end{cfa}
+\item[Rationale:] dropped from C11 standard.\footnote{
+At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each structure declaration and type name~\cite[\S~6.7.2(2)]{C11}}
+\item[Effect on original feature:] original feature is deprecated. \\
+Any old C programs using these K\&R declarations are invalid \CFA programs.
+\item[Difficulty of converting:] trivial to convert to \CFA.
+\item[How widely used:] existing usages are rare.
+\end{description}
+
+\item
+\begin{description}
+\item[Change:] type of character literal ©int© to ©char© to allow more intuitive overloading:
+\begin{cfa}
+int rtn( int i );
+int rtn( char c );
+rtn( 'x' );						§\C{// programmer expects 2nd rtn to be called}§
+\end{cfa}
+\item[Rationale:] it is more intuitive for the call to ©rtn© to match the second version of definition of ©rtn© rather than the first.
+In particular, output of ©char© variable now print a character rather than the decimal ASCII value of the character.
+\begin{cfa}
+sout | 'x' | " " | (int)'x' | endl;
+x 120
+\end{cfa}
+Having to cast ©'x'© to ©char© is non-intuitive.
+\item[Effect on original feature:] change to semantics of well-defined feature that depend on:
+\begin{cfa}
+sizeof( 'x' ) == sizeof( int )
+\end{cfa}
+no long work the same in \CFA programs.
+\item[Difficulty of converting:] simple
+\item[How widely used:] programs that depend upon ©sizeof( 'x' )© are rare and can be changed to ©sizeof(char)©.
+\end{description}
+
+\item
+\begin{description}
+\item[Change:] make string literals ©const©:
+\begin{cfa}
+char * p = "abc";				§\C{// valid in C, deprecated in \CFA}§
+char * q = expr ? "abc" : "de";	§\C{// valid in C, invalid in \CFA}§
+\end{cfa}
+The type of a string literal is changed from ©[] char© to ©const [] char©.
+Similarly, the type of a wide string literal is changed from ©[] wchar_t© to ©const [] wchar_t©.
+\item[Rationale:] This change is a safety issue:
+\begin{cfa}
+char * p = "abc";
+p[0] = 'w';						§\C{// segment fault or change constant literal}§
+\end{cfa}
+The same problem occurs when passing a string literal to a routine that changes its argument.
+\item[Effect on original feature:] change to semantics of well-defined feature.
+\item[Difficulty of converting:] simple syntactic transformation, because string literals can be converted to ©char *©.
+\item[How widely used:] programs that have a legitimate reason to treat string literals as pointers to potentially modifiable memory are rare.
+\end{description}
+
+\item
+\begin{description}
+\item[Change:] remove \newterm{tentative definitions}, which only occurs at file scope:
+\begin{cfa}
+int i;							§\C{// forward definition}§
+int *j = ®&i®;					§\C{// forward reference, valid in C, invalid in \CFA}§
+int i = 0;						§\C{// definition}§
+\end{cfa}
+is valid in C, and invalid in \CFA because duplicate overloaded object definitions at the same scope level are disallowed.
+This change makes it impossible to define mutually referential file-local static objects, if initializers are restricted to the syntactic forms of C. For example,
+\begin{cfa}
+struct X { int i; struct X *next; };
+static struct X a;				§\C{// forward definition}§
+static struct X b = { 0, ®&a® };	§\C{// forward reference, valid in C, invalid in \CFA}§
+static struct X a = { 1, &b };	§\C{// definition}§
+\end{cfa}
+\item[Rationale:] avoids having different initialization rules for builtin types and userdefined types.
+\item[Effect on original feature:] change to semantics of well-defined feature.
+\item[Difficulty of converting:] the initializer for one of a set of mutually-referential file-local static objects must invoke a routine call to achieve the initialization.
+\item[How widely used:] seldom
+\end{description}
+
+\item
+\begin{description}
+\item[Change:] have ©struct© introduce a scope for nested types:
+\begin{cfa}
+enum ®Colour® { R, G, B, Y, C, M };
+struct Person {
+	enum ®Colour® { R, G, B };	§\C{// nested type}§
+	struct Face {				§\C{// nested type}§
+		®Colour® Eyes, Hair;	§\C{// type defined outside (1 level)}§
+	};
+	®.Colour® shirt;			§\C{// type defined outside (top level)}§
+	®Colour® pants;				§\C{// type defined same level}§
+	Face looks[10];				§\C{// type defined same level}§
+};
+®Colour® c = R;					§\C{// type/enum defined same level}§
+Person®.Colour® pc = Person®.®R;	§\C{// type/enum defined inside}§
+Person®.®Face pretty;			§\C{// type defined inside}§
+\end{cfa}
+In C, the name of the nested types belongs to the same scope as the name of the outermost enclosing structure, \ie the nested types are hoisted to the scope of the outer-most type, which is not useful and confusing.
+\CFA is C \emph{incompatible} on this issue, and provides semantics similar to \Index*[C++]{\CC}.
+Nested types are not hoisted and can be referenced using the field selection operator ``©.©'', unlike the \CC scope-resolution operator ``©::©''.
+\item[Rationale:] ©struct© scope is crucial to \CFA as an information structuring and hiding mechanism.
+\item[Effect on original feature:] change to semantics of well-defined feature.
+\item[Difficulty of converting:] Semantic transformation.
+\item[How widely used:] C programs rarely have nest types because they are equivalent to the hoisted version.
+\end{description}
+
+\item
+\begin{description}
+\item[Change:] In C++, the name of a nested class is local to its enclosing class.
+\item[Rationale:] C++ classes have member functions which require that classes establish scopes.
+\item[Difficulty of converting:] Semantic transformation. To make the struct type name visible in the scope of the enclosing struct, the struct tag could be declared in the scope of the enclosing struct, before the enclosing struct is defined. Example:
+\begin{cfa}
+struct Y;						§\C{// struct Y and struct X are at the same scope}§
+struct X {
+struct Y { /* ... */ } y;
+};
+\end{cfa}
+All the definitions of C struct types enclosed in other struct definitions and accessed outside the scope of the enclosing struct could be exported to the scope of the enclosing struct.
+Note: this is a consequence of the difference in scope rules, which is documented in 3.3.
+\item[How widely used:] Seldom.
+\end{description}
+
+\item
+\begin{description}
+\item[Change:] comma expression is disallowed as subscript
+\item[Rationale:] safety issue to prevent subscripting error for multidimensional arrays: ©x[i,j]© instead of ©x[i][j]©, and this syntactic form then taken by \CFA for new style arrays.
+\item[Effect on original feature:] change to semantics of well-defined feature.
+\item[Difficulty of converting:] semantic transformation of ©x[i,j]© to ©x[(i,j)]©
+\item[How widely used:] seldom.
+\end{description}
+\end{enumerate}
 
 
@@ -5080,18 +5111,22 @@
 \leavevmode
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
-forall( otype T ) T * malloc( void );§\indexc{malloc}§
-forall( otype T ) T * malloc( char fill );
-forall( otype T ) T * malloc( T * ptr, size_t size );
-forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
-forall( otype T ) T * calloc( size_t nmemb );§\indexc{calloc}§
-forall( otype T ) T * realloc( T * ptr, size_t size );§\indexc{ato}§
-forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
-
-forall( otype T ) T * aligned_alloc( size_t alignment );§\indexc{ato}§
-forall( otype T ) T * memalign( size_t alignment );		// deprecated
-forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
+forall( dtype T | sized(T) ) T * malloc( void );§\indexc{malloc}§
+forall( dtype T | sized(T) ) T * malloc( char fill );
+forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size );
+forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill );
+forall( dtype T | sized(T) ) T * calloc( size_t nmemb );§\indexc{calloc}§
+forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size );§\indexc{ato}§
+forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill );
+
+forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment );§\indexc{ato}§
+forall( dtype T | sized(T) ) T * memalign( size_t alignment );		// deprecated
+forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment );
 
 forall( otype T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
 forall( otype T ) T * memset( T * ptr );				// remove when default value available
+
+forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p );
+forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr );
+forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } ) void delete( T * ptr, Params rest );
 \end{cfa}
 
Index: src/libcfa/concurrency/monitor
===================================================================
--- src/libcfa/concurrency/monitor	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/libcfa/concurrency/monitor	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -87,3 +87,4 @@
 void wait( condition * this );
 void signal( condition * this );
+void signal_block( condition * this );
 #endif //MONITOR_H
Index: src/libcfa/concurrency/monitor.c
===================================================================
--- src/libcfa/concurrency/monitor.c	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/libcfa/concurrency/monitor.c	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -62,4 +62,5 @@
 			//Some one else has the monitor, wait in line for it
 			append( &this->entry_queue, thrd );
+			LIB_DEBUG_PRINT_SAFE("%p Blocking on entry\n", thrd);
 			ScheduleInternal( &this->lock );
 
@@ -97,4 +98,6 @@
 		unlock( &this->lock );
 
+		LIB_DEBUG_PRINT_SAFE("Next owner is %p\n", new_owner);
+
 		//We need to wake-up the thread
 		ScheduleThread( new_owner );
@@ -149,4 +152,5 @@
 	assertf( this->monitors != NULL, "Waiting with no monitors (%p)", this->monitors );
 	assertf( this->monitor_count != 0, "Waiting with 0 monitors (%i)", this->monitor_count );
+	assertf( this->monitor_count < 32u, "Excessive monitor count (%i)", this->monitor_count );
 
 	unsigned short count = this->monitor_count;
@@ -184,6 +188,4 @@
 	}
 
-	debug_break();
-
 	for( int i = 0; i < count; i++) {
 		thread_desc * new_owner = next_thread( this->monitors[i] );
@@ -191,6 +193,4 @@
 	}
 
-	debug_break();
-
 	LIB_DEBUG_PRINT_SAFE("Will unblock: ");
 	for(int i = 0; i < thread_count; i++) {
@@ -202,5 +202,5 @@
 	ScheduleInternal( locks, count, threads, thread_count );
 
-
+	debug_break();
 	//WE WOKE UP
 
@@ -224,4 +224,5 @@
 	unsigned short count = this->monitor_count;
 	
+	//Some more checking in debug
 	LIB_DEBUG_DO(
 		thread_desc * this_thrd = this_thread();
@@ -237,8 +238,12 @@
 	);
 
+	//Lock all the monitors
 	lock_all( this->monitors, NULL, count );
 	LIB_DEBUG_PRINT_SAFE("Signalling");
 
+	//Pop the head of the waiting queue
 	__condition_node_t * node = pop_head( &this->blocked );
+
+	//Add the thread to the proper AS stack
 	for(int i = 0; i < count; i++) {
 		__condition_criterion_t * crit = &node->criteria[i];
@@ -250,5 +255,64 @@
 	LIB_DEBUG_PRINT_SAFE("\n");
 
+	//Release
 	unlock_all( this->monitors, count );
+}
+
+void signal_block( condition * this ) {
+	if( !this->blocked.head ) {
+		LIB_DEBUG_PRINT_SAFE("Nothing to signal\n");
+		return;
+	}
+
+	//Check that everything is as expected
+	assertf( this->monitors != NULL, "Waiting with no monitors (%p)", this->monitors );
+	assertf( this->monitor_count != 0, "Waiting with 0 monitors (%i)", this->monitor_count );
+
+	unsigned short count = this->monitor_count;
+	unsigned int recursions[ count ];		//Save the current recursion levels to restore them later
+	spinlock *   locks     [ count ];		//We need to pass-in an array of locks to ScheduleInternal
+
+	lock_all( this->monitors, locks, count );
+
+	//create creteria
+	__condition_node_t waiter;
+	waiter.waiting_thread = this_thread();
+	waiter.count = count;
+	waiter.next = NULL;
+
+	__condition_criterion_t criteria[count];
+	for(int i = 0; i < count; i++) {
+		LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
+		criteria[i].ready  = false;
+		criteria[i].owner  = &waiter;
+		criteria[i].next   = NULL;
+		criteria[i].target = this->monitors[i];
+		push( &criteria[i].target->signal_stack, &criteria[i] );
+	}
+
+	waiter.criteria = criteria;
+
+	//save contexts
+	save_recursion( this->monitors, recursions, count );
+
+	//Find the thread to run
+	thread_desc * signallee = pop_head( &this->blocked )->waiting_thread;
+	for(int i = 0; i < count; i++) {
+		set_owner( this->monitors[i], signallee );
+	}
+
+	LIB_DEBUG_PRINT_SAFE( "Waiting on signal block\n" );
+	debug_break();
+
+	//Everything is ready to go to sleep
+	ScheduleInternal( locks, count, &signallee, 1 );
+
+	debug_break();
+	LIB_DEBUG_PRINT_SAFE( "Back from signal block\n" );
+
+	//We are back, restore the owners and recursions
+	lock_all( locks, count );
+	restore_recursion( this->monitors, recursions, count );
+	unlock_all( locks, count );
 }
 
@@ -335,4 +399,5 @@
 
 	for(	int i = 0; i < count; i++ ) {
+
 		LIB_DEBUG_PRINT_SAFE( "Checking %p for %p\n", &criteria[i], target );
 		if( &criteria[i] == target ) {
Index: src/libcfa/concurrency/thread
===================================================================
--- src/libcfa/concurrency/thread	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/libcfa/concurrency/thread	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -82,4 +82,5 @@
 
 void yield();
+void yield( unsigned times );
 
 #endif //THREADS_H
Index: src/libcfa/concurrency/thread.c
===================================================================
--- src/libcfa/concurrency/thread.c	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/libcfa/concurrency/thread.c	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -87,4 +87,10 @@
 }
 
+void yield( unsigned times ) {
+	for( unsigned i = 0; i < times; i++ ) {
+		yield();
+	}
+}
+
 void ThreadCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
 	// set state of current coroutine to inactive
Index: src/libcfa/gmp
===================================================================
--- src/libcfa/gmp	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/libcfa/gmp	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -10,6 +10,6 @@
 // Created On       : Tue Apr 19 08:43:43 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sun May 14 23:47:36 2017
-// Update Count     : 9
+// Last Modified On : Mon May 22 08:32:39 2017
+// Update Count     : 13
 // 
 
@@ -35,5 +35,5 @@
 Int ?=?( Int * lhs, long int rhs ) { mpz_set_si( lhs->mpz, rhs ); return *lhs; }
 Int ?=?( Int * lhs, unsigned long int rhs ) { mpz_set_ui( lhs->mpz, rhs ); return *lhs; }
-//Int ?=?( Int * lhs, const char * rhs ) { if ( mpq_set_str( lhs->mpz, rhs, 0 ) ) abort(); return *lhs; }
+Int ?=?( Int * lhs, const char * rhs ) { if ( mpz_set_str( lhs->mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return *lhs; }
 
 char ?=?( char * lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }
Index: src/tests/.expect/64/gmp.txt
===================================================================
--- src/tests/.expect/64/gmp.txt	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/tests/.expect/64/gmp.txt	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -4,4 +4,5 @@
 conversions
 y:97
+y:12345678901234567890123456789
 y:3
 y:-3
@@ -24,4 +25,5 @@
 z:150000000000000000000
 z:16666666666666666666
+16666666666666666666, 2 16666666666666666666, 2
 x:16666666666666666666 y:2
 
Index: src/tests/.expect/concurrent/sched-int-block.txt
===================================================================
--- src/tests/.expect/concurrent/sched-int-block.txt	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
+++ src/tests/.expect/concurrent/sched-int-block.txt	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -0,0 +1,2 @@
+Starting waiters
+Waiters done
Index: src/tests/Makefile.am
===================================================================
--- src/tests/Makefile.am	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/tests/Makefile.am	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -22,5 +22,5 @@
 concurrent=yes
 quick_test+= coroutine thread monitor
-concurrent_test=coroutine thread monitor multi-monitor sched-int-disjoint sched-int-barge sched-int-wait sched-ext sched-ext-multi preempt
+concurrent_test=coroutine thread monitor multi-monitor sched-int-barge sched-int-block sched-int-disjoint sched-int-wait sched-ext sched-ext-multi preempt
 else
 concurrent=no
Index: src/tests/Makefile.in
===================================================================
--- src/tests/Makefile.in	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/tests/Makefile.in	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -230,5 +230,5 @@
 @BUILD_CONCURRENCY_TRUE@concurrent = yes
 @BUILD_CONCURRENCY_FALSE@concurrent_test = 
-@BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int-disjoint sched-int-barge sched-int-wait sched-ext sched-ext-multi preempt
+@BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int-barge sched-int-block sched-int-disjoint sched-int-wait sched-ext sched-ext-multi preempt
 
 # applies to both programs
Index: src/tests/gmp.c
===================================================================
--- src/tests/gmp.c	(revision 7f623d6fc2334cda8b26a77d059a48637fb5a398)
+++ src/tests/gmp.c	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -10,11 +10,11 @@
 // Created On       : Tue Apr 19 08:55:51 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sun May 14 14:46:50 2017
-// Update Count     : 530
+// Last Modified On : Mon May 22 09:05:09 2017
+// Update Count     : 538
 // 
 
 #include <gmp>
 
-int main() {
+int main( void ) {
 	sout | "constructors" | endl;
 	short int si = 3;
@@ -25,4 +25,6 @@
 	sout | "conversions" | endl;
 	y = 'a';
+	sout | "y:" | y | endl;
+	y = "12345678901234567890123456789";
 	sout | "y:" | y | endl;
 	y = si;
@@ -62,7 +64,7 @@
 	z = x / 3;
 	sout | "z:" | z | endl;
+	sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
 	[ x, y ] = div( x, 3 );
 	sout | "x:" | x | "y:" | y | endl;
-//	sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
 
 	sout | endl;
@@ -72,7 +74,7 @@
 	fn = (Int){0}; fn1 = fn;							// 1st case
 	sout | (int)0 | fn | endl;
-	fn = (Int){1}; fn2 = fn1; fn1 = fn;					// 2nd case
+	fn = 1; fn2 = fn1; fn1 = fn;						// 2nd case
 	sout | 1 | fn | endl;
-	for ( int i = 2; i <= 200; i += 1 ) {
+	for ( unsigned int i = 2; i <= 200; i += 1 ) {
 		fn = fn1 + fn2; fn2 = fn1; fn1 = fn;			// general case
 		sout | i | fn | endl;
@@ -83,7 +85,7 @@
 	sout | "Factorial Numbers" | endl;
 	Int fact;
-	fact = (Int){1};									// 1st case
+	fact = 1;											// 1st case
 	sout | (int)0 | fact | endl;
-	for ( int i = 1; i <= 40; i += 1 ) {
+	for ( unsigned int i = 1; i <= 40; i += 1 ) {
 		fact = fact * i;								// general case
 		sout | i | fact | endl;
Index: src/tests/sched-int-block.c
===================================================================
--- src/tests/sched-int-block.c	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
+++ src/tests/sched-int-block.c	(revision 447bf83332a91d5d5ad11eb1443b8eb68b0c6319)
@@ -0,0 +1,113 @@
+#include <fstream>
+#include <kernel>
+#include <monitor>
+#include <stdlib>
+#include <thread>
+
+static const unsigned N = 100_000;
+
+enum state_t { WAITED, SIGNAL, BARGE };
+
+monitor global_t {};
+
+monitor global_data_t {
+	state_t state;
+	bool ran;
+};
+
+void ?{} ( global_data_t * this ) {
+	this->state = BARGE;
+}
+
+void ^?{} ( global_data_t * this ) {}
+
+global_data_t globalA, globalB;
+
+condition cond;
+
+volatile bool done;
+
+//------------------------------------------------------------------------------
+void wait_op( global_data_t * mutex a, global_data_t * mutex b, unsigned i ) {
+	wait( &cond );
+	a->ran = b->ran = true;
+
+	yield( ((unsigned)rand48()) % 10 );
+
+	if(a->state != SIGNAL || b->state != SIGNAL) {
+		sout | "ERROR Barging detected" | a->state | b->state | endl;
+		abort();
+	}
+
+	a->state = b->state = WAITED;
+
+	yield( ((unsigned)rand48()) % 10 );
+}
+
+thread Waiter {};
+void main( Waiter* this ) {
+	for( int i = 0; i < N; i++ ) {
+		wait_op( &globalA, &globalB, i );
+	}
+}
+
+//------------------------------------------------------------------------------
+void signal_op( global_data_t * mutex a, global_data_t * mutex b ) {
+	yield( ((unsigned)rand48()) % 10 );
+
+	a->ran = b->ran = false;
+	a->state = b->state = SIGNAL;
+
+	signal_block( &cond );
+
+	yield( ((unsigned)rand48()) % 10 );
+
+	assert(a->ran == b->ran);
+	if(a->ran)
+	{
+		if(a->state != WAITED || b->state != WAITED) {
+			sout | "ERROR Barging detected" | a->state | b->state | endl;
+			abort();
+		}
+	}
+
+}
+
+thread Signaller {};
+void main( Signaller* this ) {
+	while( !done ) {
+		signal_op( &globalA, &globalB );
+	}
+}
+
+//------------------------------------------------------------------------------
+void barge_op( global_data_t * mutex a ) {
+	a->state = BARGE;
+}
+
+thread Barger {};
+void main( Barger* this ) {
+	for( unsigned i = 0; !done; i++ ) {
+		//Choose some monitor to barge into with some irregular pattern
+		bool choose_a = (i % 13) > (i % 17);
+		barge_op( choose_a ? &globalA : &globalB );
+	}
+}
+
+//------------------------------------------------------------------------------
+
+int main(int argc, char* argv[]) {
+	rand48seed(0);
+	done = false;
+	processor p;
+	{
+		Signaller s[4];
+		Barger b[13];
+		sout | "Starting waiters" | endl;
+		{
+			Waiter w[3];
+		}
+		sout | "Waiters done" | endl;
+		done = true;
+	}
+}
