![]() |
C Compilation..
is there any standards that tell us how c code has to be compiled into
machine code |
Re: C Compilation..
On 23 Aug 2008 at 8:13, raashid bhatt wrote:
> is there any standards that tell us how c code has to be compiled into > machine code Yes. Most processor vendors will provide extensive documentation with advice and guidelines for writers of optimizing compilers. For example, Intel provides all this for free on the web: http://www.intel.com/products/processor/manuals/ |
Re: C Compilation..
> No. C code need not even *be* compiled into a particular machine's machine
> code. Often it is not - it is compiled (translated) into a particular > machine's assembly language instead. It could even be compiled into some > completely different language. yes i agree , and C is perhaps a Compiled language. But when people say C code is faster than any language but i will not be true if we use diffrent compilers(as u said there is not standard of compiled code) |
Re: C Compilation..
On 23 Aug 2008 at 9:59, Richard Heathfield wrote:
> - any performance problems are more likely to be a consequence of the > solution (i.e. your program isn't written as efficiently as it might > be) than of the translation. You'd know /all/ about that. > In any case, correctness is far more important than speed. False dichotomy. You seem to take the foolish approach that speed doesn't matter at all, and choosing an O(n^2) algorithm when an O(n) algorithm is available and in fact simpler and clearer doesn't bother you in the least. Why? Because you've turned "portability" into an obsession, and nothing else matters. |
Re: C Compilation..
In article <866dncAJS_OtVDLVnZ2dnUVZ8gydnZ2d@bt.com>,
Richard Heathfield <rjh@see.sig.invalid> wrote: >> is there any standards that tell us how c code has to be compiled into >> machine code >No. Yes, several in fact.. The C standard doesn't say anything about it, but other standards specify the conventions for procedure call, linking to external variables, and so on, for many of the operating systems that C is used on. If you're writing a C compiler that's going to be widely used, you probably need to follow these standards. -- Richard -- Please remember to mention me / in tapes you leave behind. |
Re: C Compilation..
raashid bhatt wrote:
> is there any standards that tell us how c code has to be compiled into > machine code In most operating systems, the compiler that compiles the operating system is the one that decides how the format layout, interface specifications, etc are to be done. Under Microsoft windows, it is Microsoft's compiler that specifies implicitely how things should be done. This is documented in: Microsoft Portable Executable and Common Object File Format Specification Microsoft Corporation Revision 6.0 - February 1999 In that document are the full specifications for object files, executable files, and library formats. What the interface specifications is concerned (parameter passing, register a&ssignments, etc) those are specified in several pages mostly in the DDK (Driver Development Kit). Agner Fog (www.agner.org) wrote a document that makes the big tour of many different compilers in windows and shows the differences between them. The Linux world runs under the gcc evil empire, since it is gcc that compiles the linux kernel. The specification is called: SYSTEM V. APPLICATION BINARY INTERFACE. Intel386 Architecture Processor Supplement. Fourth Edition For 64 bit Linux you have: System V Application Binary Interface. AMD64 Architecture Processor Supplement. Draft Version 0.92, 2004. 18.2 ABIs. Obviously there are many operating systems, and I can't tell you about all of them. An interesting one is AIX, the IBM Unix version. Documentation for the calling conventions and register assignments is difficult to find, but there is a good document called: The Power PC Compiler Writer’s Guide Edited by: Steve Hoxey Faraydon Karim Bill Hay Hank Warren This spells you the essential details for making a correct program under this processor/OS. -- jacob navia jacob at jacob point remcomp point fr logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 |
Re: C Compilation..
Richard Heathfield wrote:
> Richard Tobin said: > >> In article <866dncAJS_OtVDLVnZ2dnUVZ8gydnZ2d@bt.com>, >> Richard Heathfield <rjh@see.sig.invalid> wrote: >> >>>> is there any standards that tell us how c code has to be compiled into >>>> machine code >>> No. >> Yes, several in fact.. > > Oh, I'm sorry. Perhaps you could enlighten us with some references? > I gave many references in my reply to the OP. -- jacob navia jacob at jacob point remcomp point fr logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 |
Re: C Compilation..
In article <slrngavo0t.tau.nospam@nospam.invalid>,
Antoninus Twink <nospam@nospam.invalid> wrote: >On 23 Aug 2008 at 9:59, Richard Heathfield wrote: >> - any performance problems are more likely to be a consequence of the >> solution (i.e. your program isn't written as efficiently as it might >> be) than of the translation. > >You'd know /all/ about that. > >> In any case, correctness is far more important than speed. > >False dichotomy. You seem to take the foolish approach that speed >doesn't matter at all, and choosing an O(n^2) algorithm when an O(n) >algorithm is available and in fact simpler and clearer doesn't bother >you in the least. Why? Because you've turned "portability" into an >obsession, and nothing else matters. Yes. I think that whatever you may think of Heathfield's ideas and posting style, even the most die-hard sycophants will have to admit that he really put his foot in it this time. You simply have to realize that in the real world, customers pay the bills *and* customers don't give a darn about "how ya did it". They care that it works and works well. No real world customer is going to prefer a "100% portable" solution that is so slow that, for all practical purposes, it can be said to simply not work. Nor is any real world customer going to answer in anything other than the obvious way when asked "So, Mr. Customer who is paying my bills, I can make this code run faster - making you look better to your bosses - but at the cost of making it not quite so aesthetically pleasing to the denizens of this Usenet newsgroup called (amazingly enough) 'comp.lang.c'. Whaddya think? Should I do it?" Mind you, all of the above is spoken as one who really does take pride in my work, likes to make my code aesthetically pleasing, and is actually somewhat miffed to find that my customers really don't give a darn about "how ya did it". But that's reality - a domain in which few clc regulars have had to function in, in decades. Maybe AT should re-post his little dialog between CBF and his hypothetical customer. Was quite illuminating. |
Re: C Compilation..
Richard Heathfield wrote:
> Richard Tobin said: > >> In article <866dncAJS_OtVDLVnZ2dnUVZ8gydnZ2d@bt.com>, >> Richard Heathfield <rjh@see.sig.invalid> wrote: >> >>>> is there any standards that tell us how c code has to be compiled >>>> into machine code >> >>> No. >> >> Yes, several in fact.. > > Oh, I'm sorry. Perhaps you could enlighten us with some references? Start with: http://en.wikipedia.org/wiki/Applica...nary_interface However, none if this would be topical in comp.lang.c... Bye, Jojo |
Re: C Compilation..
In article <lp6dnbldj6wWQzLVnZ2dneKdnZydnZ2d@bt.com>,
Richard Heathfield <rjh@see.sig.invalid> wrote: >In any case, correctness is far more important than speed. Not always. For some purposes, as someone used to have in their signature, "late answers are wrong answers". -- Richard -- Please remember to mention me / in tapes you leave behind. |
| All times are GMT. The time now is 07:26 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.