cogent icon indicating copy to clipboard operation
cogent copied to clipboard

Dargent usability improvement

Open zilinc opened this issue 6 years ago • 2 comments

If the layout of a record we want is exactly the same as what gcc uses, we still have to use dargent (which is fine) to spell out the entire layout (which is less fine) [potential improvement 1]; the C type the compiler generates then becomes an array and on the .ac side we cannot use the field access (r.f or r -> f) as usual---we have to fall back to the array indexing and cast (e.g. (u8 *)r->data[3]) or the generated getter and setter function. The function names are unstable so the .ac author won't know what to use [potential improvement 2].

zilinc avatar Sep 03 '19 06:09 zilinc

There used to be some code to generate the default Dargent layout, which was supposed to be, in principle, C-compatible. I removed it because it was exceptionally annoying to allocate it's type, as you couldn't get a name for it via antiquoation, because #Foo currently generates a C-type.

vjackson725 avatar Sep 03 '19 06:09 vjackson725

Also, right now Dargent doesn't generate getters and setters which are not used in Cogent.

zilinc avatar Sep 06 '19 07:09 zilinc