Guideline Object Format for C based objects (Suggestions? Ideas?)
TJHJ
Posts: 243
Every book I look in has a different way of doing the layout, but here is a general summary. If you all would make suggestions or changes maybe we could all use it for consistency as C seems to have no hard defined format. Ill change this main post for use as a reference.
Ok so each object should have two files minimum. A header file and a function file
Ideas suggestions?
EDIT : Original code removed. See Below for a good layout.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I owe everyone here a bunch, So thanks again for answering my dumb questions.
Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
Suzuki RG500 in a RGV 250 frame.
Bimota V-Due (Running on the fuel injection system)
Aprilia RS250
Post Edited (TJHJ) : 4/9/2009 2:31:59 PM GMT
Ok so each object should have two files minimum. A header file and a function file
Ideas suggestions?
EDIT : Original code removed. See Below for a good layout.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I owe everyone here a bunch, So thanks again for answering my dumb questions.
Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
Suzuki RG500 in a RGV 250 frame.
Bimota V-Due (Running on the fuel injection system)
Aprilia RS250
Post Edited (TJHJ) : 4/9/2009 2:31:59 PM GMT
Comments
Just one symantics note: We don't really talks about objects with "Standard C" although you do have classes and objects in C++. Normally they are just called modules or libraries. A module generally is one .c file and it's .h file. What you have described is a module. A library is many modules and often compiled into .a or .so binaries that have .h files to describe the API or Applications Program Interface (and have version numbers in linux for example but that's over-kill for our situation).
I don't really like pushing coding standards because it can be a PITA. I would call anything discussed in such terms a "guideline" for those who may not be familiar with the way things are done in some industry settings.
I'll borrow your starting point and expand on it.
That's the way I do it and I'm not asking any experienced programmers to follow it. This is a matter of style.
Everyone develops a style. I roll my eyes when someone suggests I have to do something a certain way ....
if I'm getting paid to follow a coding standard I'll follow it ... hesitantly [noparse]:)[/noparse]
Hope this helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
I think that sums up my idea quite well.
And well I say object because well there in the object exchange....
You are right in saying standard is a bad idea, guideline is much better. I just wanted to get something I personally could follow that made sense to everyone else. And maybe if it would help someone else not make the same mistakes I have.
Maybe other people could post their style outline as a reference if needed.
TJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I owe everyone here a bunch, So thanks again for answering my dumb questions.
Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
Suzuki RG500 in a RGV 250 frame.
Bimota V-Due (Running on the fuel injection system)
Aprilia RS250