Changeset 134b86a for translator/examples/array.c
- Timestamp:
- Nov 3, 2014, 4:38:08 PM (10 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, string, with_gc
- Children:
- 8c17ab0
- Parents:
- 93885663
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/examples/array.c
r93885663 r134b86a 10 10 /// { 11 11 /// begin = 0; 12 /// end = array_last( array );12 /// end = last( array ); 13 13 /// } 14 14 15 // The first element is always at index 0. 15 16 forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) ) 16 elt_type * 17 get_begin( array_type array ) 18 { 19 return &array[ 0 ]; 17 elt_type * begin( array_type array ) { 18 return &array[ 0 ]; 20 19 } 21 20 21 // The end iterator should point one past the last element. 22 22 forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) ) 23 elt_type * 24 get_end( array_type array ) 25 { 26 return &array[ array_last( array ) ] + 1; 23 elt_type * end( array_type array ) { 24 return &array[ last( array ) ] + 1; 27 25 } 28
Note: See TracChangeset
for help on using the changeset viewer.