Changeset a04ce4d
- Timestamp:
- Jul 27, 2017, 12:38:55 PM (7 years ago)
- 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:
- fcd17b2f
- Parents:
- 6165ce7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/designations.c
r6165ce7 ra04ce4d 9 9 // Author : Rob Schluntz 10 10 // Created On : Thu Jun 29 15:26:36 2017 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Thu Ju n 29 15:27:05 201713 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 27 11:46:35 2017 13 // Update Count : 3 14 14 // 15 15 … … 89 89 }; 90 90 91 struct Fred { 92 double i[3]; 93 int j; 94 struct Mary { 95 struct Jane { 96 double j; 97 } j; 98 double i; 99 } m; 100 }; 101 struct Fred s1 @= { .m.j : 3 }; 102 struct Fred s2 @= { .i : { [2] : 2 } }; 103 91 104 int main() { 92 105 // simple designation case - starting from beginning of structure, leaves ptr default-initialized (zero) … … 199 212 }; 200 213 #endif 201 214 // array designation 215 int i[2] = { [1] : 3 }; 202 216 // allowed to have 'too many' initialized lists - essentially they are ignored. 203 217 int i1 = { 3 }; … … 240 254 const char * str0 = "hello"; 241 255 char str1[] = "hello"; 256 const char c1[] = "abc"; 257 const char c2[] = { 'a', 'b', 'c' }; 258 const char c3[][2] = { { 'a', 'b' }, { 'c', 'd'}, { 'c', 'd'} }; 242 259 } 243 260
Note: See TracChangeset
for help on using the changeset viewer.