BUG: SystemABI C_LONG and C_LONGLONG are the same

Ty Young youngty1997 at gmail.com
Mon May 18 11:55:47 UTC 2020


On 5/18/20 6:09 AM, Maurizio Cimadamore wrote:
>
> On 18/05/2020 11:57, Ty Young wrote:
>> In order to drop attributes you need to know which attributes to drop 
>> though, right? If someone is marking a layout with their own 
>> attributes willy nilly this may be impossible unless they provide the 
>> key strings. I also think it's a bit dangerous simply because they 
>> could mark a layout with the attributes but have the values be 
>> invalid. I can already see someone using a `long` layout that has an 
>> attribute "class" that points to byte.class.
>>
>>
>> The only way I can think of solving this is by introducing 
>> "ContableGroup". You could then have a method that strips a layout of 
>> all attributes but those within the supplied group. Doing this also 
>> has the added benefit that a signature could be added to validate who 
>> the attributes belong to.
>
> I believe we are in overthinking territory. Why would you want to 
> compare layouts _and_ discard only few attributes but not all?


Discarding *ALL* attributes would just get you back to 
SystemABI.C_<TYPE>, no? You need a way to say "I want the layout as if 
it had *THESE* attributes and *NOTHING* else". Otherwise comparing will 
always fail.



> My suspicion is that you would simply want to check if some layout is 
> e.g. the layout for a NativeLong - in which case (by far) the easiest 
> way to do that is to add a layout attribute which says 
> (carrier=NativeLong.class) and then just check for that (e.g. w/o 
> doing a full blown layout comparison).


What if some other API already uses that attribute? Or if it's set to 
something completely invalid?


Maybe it's just me, but I find attributes like "class" and/or "handle" 
to be, while generic, at least safer... at least for everything but 
long(and similar).




>
> Maurizio
>


More information about the panama-dev mailing list