??? 11/04/08 20:30 Read: times |
#159656 - from where I sit... Responding to: ???'s previous message |
I said:
I can use the very same argument: why bother with creating a separate file and go through all the oddities of linking it together with the C part? Erik Malund said:
1) what oddities? Well, the sheer fact that you have to link files, is an added - and often unjustified - complexity, as compared to a single-file project. Especially in an environment with very relaxed link between the formal declaration of variables and parameters passed to and from functions in a module, and the implementation of module itself. Yes, the separate header files - and a chain of them (plus a bunch of switches to the compiler) - in order to define basic things such as what the hell is char and int - are a very stupid idea. Then, linkers tend to be quirky animals. I - the dedicated C-hater - was pushed to use several different Cs and their toolchains (on different processors/mcus) in the past few months, and have tons of stories to tell. About a half is linking related (and half of the rest is make related which is an another bunch of very stupid design decisions). But that's maybe just me, who's stupid here. Erik Malund said:
2) why put an assembler function in a C module Why not if it is related to the topic of the module? For example, if I have a communication library, with relatively extensive functions for e.g.assembling/disassembling packets, adding headers/footers - which, together with deffinition of necessary resources (buffers, pointers) would quite naturally occur in C; I see fully justified to add to that very library the low-level interrupt service routine which transmits and receives bytes to/from the buffers - and, as it is very often the case, it is fully justified to write these ISRs in asm, because of speed, latency, whatever. JW |