ericb59 / Fusion-C-v1.2

MSX C Library for SDCC compiler
Other
71 stars 7 forks source link

More consistent naming of functions #1

Closed mdbijl closed 4 years ago

mdbijl commented 4 years ago

Hi, great initiative and thanks for the effort! I bought the book and started reading. What I see is that the Fusion-C library could benefit from a more consistent naming convention for function names.

Most of them are camelcased and start with an uppercase character: FunctionName() but some start with a lowercase character and use underscores: function_name()

I would propose to unify it and make it consistent.

Also, what is the reason (other than style) to start function names with an uppercase? To keep it inline with other c-libraries and languages I would prefer to use a lowercase, like functionName() and not capitalize words like MSX and VDP: vdpFunction() and someMsxFunction(), but that’s just personal taste ;-)

Anyway thanks for sharing on github, am looking forward to contribute a bit.

ericb59 commented 4 years ago

Thank you for your interest in FUSION-C. You're right, some functions (a minority) are not named as I wish. First of all, my choice for capital letters (CamelCase) is completely personal. I like that a listing is perfectly readable, and whose functions are perfectly identifiable. It's a personal choice. This may annoy some other coders, I understand it well.

To solve the problem of the functions that are not in "CamelCase" I think to add some #define in msx_fusion.h In the same way we can choose another way of naming the functions, by creating a lexicon with #define

define JoystickRead joytickRead

or

define JoystickRead joyrd

Any help to evolve FUSION-C is welcome :-)

mdbijl commented 4 years ago

Hi Eric. Thanks for responding. I understand and I like the #define approach.

mdbijl commented 4 years ago

Mmm. Looking into it, it will be quite cumbersome to add #defines and maintaining them, mostly because structs also have the same CamelCased code style:

typedef struct { char DriveN; .... } DSKPARAMS;

Users coming from object-oriented languages will have difficulty with this, as a name started with a capital is considered a class. Again, I agree it's mostly personal preference, but maybe it's an idea to adopt some coding style that is written down somewhere or checked by a some tool so you don't get annoyed with questions like mine :-)

ericb59 commented 4 years ago

"maybe it's an idea to adopt some coding style that is written down somewhere or checked by a some tool "

Yes you are right. Which coding style do you suggest ? I will certainly update that in a futur version.