Re: help a beginner with a basic function that should return a char



On 2009-07-12, Nobody <nobody@xxxxxxxxxxx> wrote:
On Sat, 11 Jul 2009 22:26:00 +0000, Tim Harig wrote:
There are many things that are possible to do with C standards but which
are not necessarily great programming practice. I don't think depending
on the duality the behavior of static variables and those in local scope is
such a great idea. I never declare anything static and I don't depend on
the fact that literal strings will be. I always make the simplified
assumption that everything local will be gone when returning and my code
works. If that not what is happening behind the scenes then I have still
lost very little; but, I have potentially avoided problems like dlopen()
without explicity accounting for the possiblility.
The usual solution to dlclose() issues is simply not to call dlclose().

Which rather defeats the part of the idea of runtime loadable modules. Do
you think it is less a waste of resources to have blocks of code segments
that are not being used in memory when you could instead offload what you
are not using?

anyone). Literal data belongs in the .rodata segment, or in a file which
is mmap()d read-only, not on the heap.
I don't often have resource problems on modern machines. When in conflict,
I will choose better design and more flexible code over fast code. I can
always, easily and relatively cheaply, add more RAM, more storage, or more
processing power.
I use gettext() as black box. How it implements itself is its own
business. I have never had resource problems because of it.
This approach is one of the biggest hurdles to the use of application
servers. Applications tend to be written as if each user has the resources
of a desktop PC to themselves. Much of the efficiency which could be
obtained with a shared server is wasted because applications allocate
large amounts of unshared memory in spite of the fact that much of the
data will be common to all instances of a program.

Funny, I have written servers before which had no performance problems and
the world hasn't endeded since I didn't pass any literals from functions.
In fact, my programs are known internally for being extremely small,
simple, and stable.

There are always a few who get off by shaving that extra millisecond.
They spend more time writing their code and the result is usually more
complex leading to worse bugs. Their performance gains are insignificant
compared to the extra salary and benefits costs in the time that they
waste.

I suppose that it is macho to squeeze out those extra resources; but, I
have never been given to attempting to be macho. I prefer simple, solid
code that is good enough performancewise to get the job done in spec.
.



Relevant Pages

  • Re: Good Dungeon Mapping e-Tool?
    ... for that, it doesn't extend well to other resources, and isn't ... of late to add it to every programming environment that gets created. ... explicit dispose call even though the GC would clean up the purely ... whether the interface that you're using points to a disposable object ...
    (rec.games.frp.dnd)
  • Re: Threads and Ruby
    ... you must either synchronize or avoid access to shared resources. ... standard implementation of Ruby doesn't do it well. ... a message passing fashion and even more often use those threads to ...
    (comp.lang.ruby)
  • Re: Newbie FAQ
    ... are secondary to commercial implementations, ... collaborative programming in LISP, ... (Which is why you all are not so good at programming. ... current and accessible online resources. ...
    (comp.lang.lisp)
  • Re: Starting from scratch with .Net Framework -- Where to begin?
    ... reference, plus introductory articles, How-tos, Starter Kits, Sample Code, ... I'm about to take a job where I'll be doing .net programming, ... Visual Basic, C#, and ASP.Net, and I'd like books or resources showing ... from basic 'hello world' apps to database integration with MS SQL ...
    (microsoft.public.dotnet.framework)