Digital set-top boxes (slightly O/T) - weak signal area.

Ah. Thanks for letting us know that.

.andy

To email, substitute .nospam with .gl

Reply to
Andy Hall
Loading thread data ...

Pleasure.

Reply to
IMM

C was writen by engineers, as a way if writing assembler faster.

Thats why its good for operating systems.

Hwver you do need a *little* assembler here and there.

I have written an operating system in C and assembler.

Reply to
The Natural Philosopher

"IMM" wrote | You obviously don't know about C. The problem with C is that | if the programmer is not educated to write structured code it | is awful and spaghetti like. Pascal is the best language to | learn from as it forces the user into a reasonably structured | way.

Well it did until this user found GOTO in the book and whooped with joy. I also found the sentence that said "always re-use code wherever possible" so I re-used the code of the chap sitting next to me.

Owain

Reply to
Owain

Kernigan and Rickie to be precise. They wrote the UNIX operating system with it (UNIX was a pun on Multix a Honeywell OS). The centre kernel of most UNIX versions is in machine code.

Depends on the compiler. A compiler only converts ASCII text to whatever. A written program is only a document, just like a letter.

Do you mean UNIX kernel? Add your bits and re-compile.

For applications C is not the thing as it can be slow to produce programs. A boss would be better with a 4 GL as it is faster and a slight learning curve.

C is very powerful.

Reply to
IMM

That must be some new meaning of the word "precise" with which I was not previously familiar...

Kernighan and Ritchie must be two of the most famous names in computing. You spell them both wrong and call it precise. Get back under your stone and stop digging yourself into a deep hole again.

Reply to
Andy Wade

So you are good at spelling? What do you know about C and UNIX, oh smarty? Probably just superficial stuff and then you an expert. Duh!

Reply to
IMM

Just a small point. If you don't spell correctly, you will run into trouble with C especially. If you don't punctuate correctly then the results can be insidiously wrong and the compiler may not report it.

.andy

To email, substitute .nospam with .gl

Reply to
Andy Hall

Since when has Kernighan and Ritchie been reserved words in C. Duh!!

Reply to
IMM
.

I was commenting in general as you well know.

.andy

To email, substitute .nospam with .gl

Reply to
Andy Hall

Yes and no. C was devloped from B, which was developed from BCPL.

kernighan and Ritchie simply wrote tghe official book, there wer others involved in its design and evolution.

Yes and no. You can. of course write 'inline assembler' in 'C' in most complers.

However it is not 'C'

C nbeing a stack based language, and having very little cobncetp of registers - since the PDP CPU doesn't have many - does not map well or make efficient use of registers.

Neither has it any concept of using IO space within the language, nor is it very effeicient in all cases at doing bitmap operations.

To talk to the hardware usinc C alone is not possible. You have to have at some level at least an assembler coded subroutine to do e.g. an IO call, and other generic bit twiddling is usuially faster and easier to implement in assembler, as are interrupt service routines.

It is of couse he fact tghat RISC chops are now being produced that enavle almost pure C to be used to drive them - the are ooptimised for teh way it does things. However Intel type architectires do NOT map well into C and its a tribute to teh complier writers that we get teh performance we do.

No, I mean a dedicated operating system for an 8088 microprocessor board.

I have in fact written the equivalent of what a home computer running FORTH would have run in the early 80's. From scratch.

Horses for courese. Most higher level languages are woefully inefficient.

The problem with C is never speed, it is that it gets very big and hard to debug on higher level stuff. It is the actual problems of miantaining control over a huge project written in C that eventually make 4GL type lkanguase -0 inefficient tho they are speed wise - at least manageable in terms of software engineering.

Its as powerful as teh processor and machine it runs on.

Forth is smaller, but slower. In many respects its smaller than assembler in terms of the program sizs. Its a bitch to write tho :-)

Stuff like PDL or BASIC is easy to cobble up stuff in, but woefully slow. AND big.

Reply to
The Natural Philosopher

Until you have scratched your head over how to get out of 16 level deep nested subroutines and abort a whole process in Pasacal, an drealised that - shit, yes, setjmp()and Longjmp() are in fact exactly what you need to get back to a fresh start when you have detected deep in the mire that the other end has dropped the line on you...

Pascal is fine for teaching, and that every subroutine has an entrance as well as an exit, but sometimes you just want to crash through it all and start over. Pascal means you have to write an explicit error handler at EVERY level.

You can't write a real time task scheduler in it either. Mind you its pretty impossible in 'C' as well. You need to do nasty theings like manipulationg stack pointers - a complete nono in C - for good reasons!

Reply to
The Natural Philosopher

I obviously do.

Hmm, first "C beats em all", and then apparently it doesn't :-)

They all are, to a greater or lesser extent.

I would guess that 90+% of all security holes have been a result of crappy C coding, or maybe C++, its bastard offspring. If the language (or perhaps its "standard library") was as good as you claim, such mistakes wouldn't be so easy to make. You can't simultaneously applaud a language and deride its users for not being smart enough to avoid writing bad code in it.

Reply to
John Laird

Not much.

It is brilliant for what it was intended, and even more.

Proper in-depth programmers. You could say that someone who puts together a spreadsheet is a programmer.

You can deride its users. Programmers have to know what the hell they are programming and that includes know about security.

Reply to
IMM

I'm not sure your guess is accurate. C is about as close to machine code as it is possible to get. With Pascal et al the compiler typically adds error checking to catch situations such as when a divide by zero occurs - C compilers don't usually add that overhead.

I have programmed in C, C++, Pascal, Fortran, Visual Basic and a couple of other languages. Of them all, C was the one that was inherently "unstable" from a programmers point of view. It was far easier to program a routine to crash the host computer with C than for other languages.

But at the same time, C was also inherently quite forgiving in terms of casting and similar situations. I quite liked C because you could perform desired operations without having to jump thru hoops to either become compliant with the compilers needs, or deliberately instruct the compiler to ignore the error caused by the programming need.

PoP

Sending email to my published email address isn't guaranteed to reach me.

Reply to
PoP

Err, no. Machine code is as close to machine code as it is possible to get.

Then assembler.

Then 'C'.

'C' combines all the power of assembler with all the security and ease of use of ... assembler.

.file "hello.c" .section ".rodata" .align 8 .LLC0: .asciz "Hello World!\n" .section ".text" .align 4 .global main .type main,#function .proc 04 main: !#PROLOGUE# 0 save %sp, -112, %sp !#PROLOGUE# 1 sethi %hi(.LLC0), %o0 or %o0, %lo(.LLC0), %o0 call printf, 0 nop mov %o0, %i0 nop ret restore .LLfe1: .size main,.LLfe1-main .ident "GCC: (GNU) 3.2.2"

Reply to
Huge

I think you mean assembler.

So, a powerful language that you have to know what you are doing with it- like assembler and machine code. C wasn't meant to compete with COBOL.

Reply to
IMM

Sorry, didn't realise you were pedantic.

PoP

Sending email to my published email address isn't guaranteed to reach me.

Reply to
PoP

In article , PoP writes

Any decent compiler or operating system will provide varying and definable levels of checking.

What !. There is nothing unstable about 'C' (unless you are using version 1.0 of the compiler) - it is the way it is used and how well it is tested that counts. If you insist on using pointers that don't point to anything, what do you expect. On a decent machine with memory protection and privileges (like a VAX/Alpha) you should only be able to crash your own process, never someone else's. C is after all a high level assembler (anyone used Plan ??), and while there may be better languages for writing operating systems [1], the closer you get to the hardware the more useful it is. For bit-twiddling it is perfect. I wrote the software for an analogue-addessable fire alarm over 10 years ago. Main board had a trusty Z80 with 32K rAM and

64K bank switched EPROM (Z80 =cheap to buy in quantity and available in CMOS, which is what you need for extended power fail sits.). Loop controllers - 8051 with 128 *bytes* of RAM but as much EPROM as you need, written in assembler and debugged with a 'scope. Had to do it for a fixed price and the hardware didn't exist at the time, and hardware guy had been rescued from redundancy at the age of 60 and had never done a digital board in his life. Interesting time - I had no idea how much information could be obtained just using humble 2 channel 'scope, and not even storage one. Oh, and I used C because Hitech (Oz company) did a cheap compiler for the Z80 and provided you avoided bit manipulation on stack items it generated tolerable code. Also meant I could use an intelligent EPROM emulator to debug and single step in machine code. [1] (DEC->Compaq-> Now Hewlett Packard ACMS still has modules written in Bliss32. In fact I think it still their favourite language. Personally I still think VAX FORTRAN 77 version 3 running VMS V3 was the best combination, even for 'commercial' work since it had reasonable character string handling - and if you used a separate database handler you didn't need to use the languages rudimentary file handling. PS the London Teching hosp. where I used the latter used to use an Elliot 803 in the sixties - apparently it used mag tapes with sprocket holes (so I was told).
Reply to
Andrew

Notice I used quotes in my original description :)

But that's the point (pun not intended). C allows you to do such a thing, and the program will compile. Perhaps modern day C compilers are more robust than what I was used to (I last used C in earnest about 5 years ago), but my experience was that the C compiler did not automatically produce code that did runtime checking. Whereas pascal (etc) from the same vintage did.

BTW, of all the languages of which I am familiar I think C is/was my favourite - it was lean and mean. I never liked pascal that much, never did figure how anyone could like having to write "begin" and "end" in program constructs (much easier to use curly brackets - less typing). Fortran is model 'T' Ford vintage. VB is bloatware. And C++ was overloaded (pun intended) with features - very useful most of them, but my eyes glazed over a bit with some of the buzzwords like polymorphism, overloading, etc. Nothing wrong with C++, just that it wasn't for me really.

PoP

Sending email to my published email address isn't guaranteed to reach me.

Reply to
PoP

HomeOwnersHub website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.