We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
There were a couple of questions regarding coding style in the previous thread. 1) The problem is that I am a strong advocate for the OOP principle of data encapsulation and inheritance. Though C does does support them directly in semantics, you can still use these principles by modifying your style. In my current design I have a IoPins module, a HardwareInterfaceA module, and a HardwareInterfaceB module. The problem is that the code in BOLD is illegal. Hence my quest for the work arounds. (I could have defined a base class of IoPinsAddress, but I like the idea of encapsulating the type with the address.) Ideally I would like:
// 'class' IoPins volatile IoPins_xOUTC pdata _at_ 0x68; volatile const IoPins_xPINSC pdata _at_ 0x78;
// 'class' HardwareInterfaceA : IoPins #include "IoPins.h" volatile pdata struct { BYTE :2; BYTE ResetLCD :1; } IntfA_Pins _at_ IoPins_xOUTC;
// 'class' IntfB : IoPins #include "IoPins.h" volatile const pdata struct { BYTE :1; BYTE ResetLCD :1; } IntfB_xPins _at_ IoPins_xPINSC;
Ideally I would like:
volatile pdata struct { BYTE :2; BYTE ResetLCD :1; } IntfA_Pins _at_ 0x68;