Is there a convention for naming types and variables?
For example, I have a type named Context
which means that I canβt name a variable below Context
. I could rename type to Context_Type
but then would need to add _Type
to the rest of the types in this library lest I be inconsistent.
Alternatively, I can name the variable Ctx
and leave the type as Context
(also Dev : Device
, Devices : Device_List
, etc.) which is the approach Iβm taking now.
What is the canonical Ada way? I much prefer to use full variable names (in Ada) as opposed to abbreviations. Iβm trying to follow the AdaCore naming approach as much is possible but it fails in the case above.
function Init (Context : out Context) return C.int with
Import => True, Convention => C, External_Name => "libusb_init";
And a follow-up example belowβ¦
I canβt have a Device_Descriptor
since thatβs a record type in my library. I decided to use the _Kind
suffix but Iβm not happy about it.
type Descriptor_Kind is
(Device_Descriptor_Kind,
Config_Descriptor_Kind,
String_Descriptor_Kind,
21 posts - 10 participants
Read full topic