Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Is this acceptable (i.e., compliant) code?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Dave Thompson, post: 2383589"] Agree the same benefit -- and I don't understand anyway why it's important to "find main" but not similarly find anything else. Better habits is arguable -- there are benefits to both topdown and bottomup. Ideally I would say teach (and practice) *both*, but the OP sounds like he already has quite enough material he needs to cover. But he didn't say to put them in a header; I understood him to mean putting them above and below main() in the source (.c) file. Personally I don't like the before/after split; if/when I want to do topdown, I put *all* forward declarations before main(), or the other top-level/entry routine(s) for a non-main module. Strictly speaking C89 does not require predeclaring functions in certain limited cases, but ignore that; it's *abysmal* style. Separate (forward) declarations are a little extra work to write and maintain, and take up some space, but if you use prototypes for both file-scope declaration and definition, as you should, any mismatch will (is required to) be diagnosed. I don't see how it "discourages" marking static=internal -- if anything, by collecting the internal declarations in one place, while the external declarations should be (as you noted earlier) in a header file, I think it makes it slightly *easier*. - David.Thompson1 at worldnet.att.net [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Is this acceptable (i.e., compliant) code?
Top