View Single Post
  #103   Report Post  
Posted to uk.d-i-y
The Natural Philosopher[_2_] The Natural Philosopher[_2_] is offline
external usenet poster
 
Posts: 39,563
Default [OT] PDP-11 programmer wanted?

On 21/06/13 12:32, Tim Streater wrote:
In article ,
The Natural Philosopher wrote:

On 21/06/13 11:17, Tim Streater wrote:
In article ,
The Natural Philosopher wrote:


If any PHP 'program' I write is more than a couple of pages, or

is anything more than a basic way to interrogate a database and
present the results onscreen, I consider its the wrong tool and I
reach for the c compiler.

Well I used to know C, and wrote a largish stats gathering and

command multiplexer in it 25 years ago. But these days I can't be
arsed to worry about memory allocation and string handling. So it's
PHP every time, even to the extent of writing a bayesian spam
filter in it.

I find string handling WORSE with PHP, than C actually. Sure the easy
things are easier with PHP., but take the case where you want to
spilt string into little strings.

In C, you can just assign a pointer to the start of each bit, and
replace the separator with a null byte, and without any extra memory
being used, that's how you split it up.

Its a bloody nightmare in PHP..and you end up with a huge amount of
redundant memory used up in string fragments you no longer need. You
cannot alter a string in PHP easily.

As far as memory allocation goes well I do it the old fashioned way.
99 times out of 100 I know the size, so its allocated at compile
time. I try not to use malloc/free.

And if its a small program that runs and exist, who need free()
anyway? Just allocate,use, and then close the program!


The program I was referring to was in the manner of a daemon. Running
under VMS on a MicroVAX 2, It typically ran for 9 months at a time,
and was only shut down then because of the site wide power outage
while they did maintenance on the 132kV line supplying power to the
site (they had to switch over to the backup 64kV line).

well daemons as opposed to cron invokedprograms do need to be careful
about memory allocation indeed.

And they had better not segfault. :-0)



--
Ineptocracy

(in-ep-toc-ra-cy) €“ a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.