Changeset 292d6cf6


Ignore:
Timestamp:
Oct 30, 2024, 11:05:41 PM (3 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
b7921d8
Parents:
520fa9e (diff), 5485bcac (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/proposals/tuples.md

    r520fa9e r292d6cf6  
    240240allow restructuring when the type is passed as a type value. This may be
    241241the most correct form, but seems surprising compared to the common use.
     242
     243### Tuple Arrays Not Supported
     244
     245You cannot make an array of tuples. For some reason the type just will not
     246work. Thoretically it could, each tuple type has a size and alignment and
     247could be put in an array. However the following type is not accepted:
     248
     249        [int, char] array[3] = {{1, 'a'}, {2, 'b'}, {3, 'c'}};
     250
     251Now the opposite, a tuple containing an array, does actually work:
     252
     253        [int[3], char] data = {{1, 2, 3}, 'd'};
    242254
    243255### Unary Tuple Value Syntax
     
    539551        ([int, int, int])tuple_int_int;
    540552        ([long, [float, int]])tuple_long_float_int;
     553
     554### Tuple Array Support
     555
     556Arrays of unstructured tuples/packs are not actually required, an array of
     557structures will store the data just as well and this is not the transient
     558context where the unlabeled tuples work well. So it would work fine to
     559not allow an array of packs, but if we do not a better error should be
     560created.
     561
     562All that being said, the following could just work.
     563
     564        [int, char] u_array[3] = {...};
     565
     566What should definitely work is an array of struct tuple, because that should
     567work where a generic structure could be used. This is also part of why arrays
     568of packs are not needed.
     569
     570        tuple([int, char]) s_array[3] = {...};
    541571
    542572### New Tuple Literal Syntax
Note: See TracChangeset for help on using the changeset viewer.