Re: Dynamic linking with LD_PRELOAD - get it compiled



On Mar 13, 6:02 am, phil-news-nos...@xxxxxxxx wrote:

| But none of that will happen if you start out knowingly doing it
| wrong.

Not necessarily. I call it "prototyping". I see no reason not to let
it loose, as as long as you don't make any claims that it is believed to
be done right.

Yeah, that's a fair point. It may ultimately be more efficient to do
it a bit "fast and loose" the first time, rather than wasting time
improving an implementation you are probably just going to throw away.
If it happens to meet all of your requirements, and it turns out not
to be too horribly awful, you're done. If it turns out not to and to
be truly awful, at least you'll have gained some insight into what
works, what doesn't, and why.

I would still argue that you should at least put in appropriate
cautionary comments, #ifdef's and #warning's.

For algorithmic code, it's a very good idea to build in some test
cases and check out the code on startup. A good example would be an
application with a "quick and dirty" implementation of something like
MD5. If you haven't checked it on systems with a different size for
some of the types you use or a different endian-ness, a few quick
check hashes on startup will catch a problem before it results in
incorrect operation.

DS
.