Re: Compiling source code out of the blue



On Wed, 2 Jan 2008 08:11:15 -0600, Tomás Ó hÉilidhe wrote
(in article <Xns9A1990538E4A1toelavabitcom@xxxxxxxxxxxxxx>):

Randy Howard <randyhoward@xxxxxxxxxxxxxxxxx> wrote in comp.lang.c:

That can happen with code coming from <any platform>. It isn't fun,
because a blanket statement like "it just works fine", when taken from
code that hasn't been ported already, implies a lot about the person
giving it to you, and almost nothing about the code itself.


I tend to be dealing with command-line programs which should be fully-
portable. For example, a program to calcuate a network card's serial
number from its MAC address.


You don't need errors or warnings? How can you possibly support that,
/especially/ the former?


Because the program is know to work perfectly.

On some other platform. "known to work" programs frequently suffer
from bugs that don't appear on Platform A when you move it to PLatform
B. Platform-specific interfaces, UB, byte-order issues, lots of
things.

Working with Linux, people distribute source code a lot. So much so, that
gcc comes built-in to the operating system. You think you're downloading
a binary for a program, and then when you open readme.txt, it tells you
to do:

make
make install

Usually come configuration is required for anything but trivial
programs, such as the ./configure stuff.

Makefiles are nice for this for anything but trivially small projects.
If you are getting projects that were built with something like Visual
from MS, the project files are likely to not help you much on other
platforms, so you may have to build some of these yourself, unless you
really like invoking things manually file by file.


What's a makefile? Is it a list of parameters to pass to the compiler? Is
there any standard kind of makefile, or do all compilers have a different
format?

Are you serious?

* Applies any and all optimisations it wants.

You want the compiler to decide the optimization settings? I'd think
a good starting point might be -O2.


Interestingly enough, I compiled by program with -O3 and now the binary
doesn't work properly... I'll look into why.

I guess the code isn't perfect after all.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





.



Relevant Pages

  • Re: made it to page 4 of gforth tutorial
    ... the stack space anyway. ... And there are clearly going to be some platform ... came with an embedded C compiler once. ... like I've written before, if one *really* needs recursion (as I have, ...
    (comp.lang.forth)
  • Re: interesting use of NEXT SENTENCE vs. CONTINUE
    ... These days I don't do compiler maintenance, but I HAVE done in the past, so ... You had a chance to point out how adherence to the standard can improve ... >> compile it WITH MINOR MODIFICATIONS for a specific platform. ... > platform-specific extension to COBOL ...
    (comp.lang.cobol)
  • Re: interesting use of NEXT SENTENCE vs. CONTINUE
    ... I DID think any old compiler would be able to ... > compile it WITH MINOR MODIFICATIONS for a specific platform. ... > not going to go to the Standard to see what SHOULD work. ... If you write your COBOL code avoiding the things that are marked as ...
    (comp.lang.cobol)
  • Re: The Lisp Curse
    ... a platform has lived that long, then yes, it could. ... Object code from 1964 will run on today's IBM machines. ... assembler and get anything written since then to run. ... gcc was originally a Pascal compiler. ...
    (comp.lang.forth)
  • Re: Standard Ada Preprocessor
    ... because Ada cannot deal with the portability issues. ... > you are interfacing directly to some special-purpose hardware. ... by their nature not compiler ... one platform you get 3 members back, and on another you get 5, ...
    (comp.lang.ada)