Changeset f80e0218 for src/examples/Attributes.c
- Timestamp:
- Jun 30, 2016, 4:32:56 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- ea29e73
- Parents:
- 1b5c81ed (diff), 84d4d6f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/examples/Attributes.c
r1b5c81ed rf80e0218 6 6 // @max 7 7 // 8 // 2. a direct application to a manifest type8 // 2. a direct application to a manifest otype 9 9 // 10 10 // @max( int ) 11 11 // 12 // 3. constraining a type variable; the application is implicitly performed at the call site as in (2)12 // 3. constraining a otype variable; the application is implicitly performed at the call site as in (2) 13 13 // 14 // forall( type T | { T @max( T ); } ) T x( T t );14 // forall( otype T | { T @max( T ); } ) T x( T t ); 15 15 // 16 16 // … … 23 23 // x = (*attr_var); 24 24 // 25 // 2. an indirect application to a manifest type25 // 2. an indirect application to a manifest otype 26 26 // 27 27 // (*attr_var)( int ) 28 28 // 29 // 3. a direct application to a type variable29 // 3. a direct application to a otype variable 30 30 // 31 31 // @max( T ) … … 47 47 // 3. polymorphic 48 48 // 49 // forall( type T | constraint( T ) ) int @attr( T );49 // forall( otype T | constraint( T ) ) int @attr( T ); 50 50 51 51 int @max = 3; … … 53 53 int main() { 54 54 int x; 55 type @type(type t); // compiler intrinsic56 type @widest(type t);57 @ type(x) *y; // gcc:typeof(x) *y;58 const @widest(double) *w; // gcc: consttypeof(x) *w;59 * @type(3 + 4) z; // cfa declaration syntax55 otype @otype(otype t); // compiler intrinsic 56 otype @widest(otype t); 57 @otype(x) *y; // gcc: otypeof(x) *y; 58 // const @widest(double) *w; // gcc: const otypeof(x) *w; 59 // * @otype(3 + 4) z; // cfa declaration syntax 60 60 y = @max; 61 61 z = @max(x) + @size(int);
Note:
See TracChangeset
for help on using the changeset viewer.