2066-pin processors

True.

Nonsense.

Rubbish.

Perhaps your software developers don't use memory protection appropriately on your systems - other people do.

You will find that on any modern "big" OS (even Windows), trying to write to the code segment of your program will cause a segmentation fault (or equivalent fault). You get the same effect if you try to execute data or the stack. You need specific features, calls, permissions, etc., to mix data and code - something required for JIT compilers, VM's, etc. (Remember what I said about high security working against usability?)

On microcontrollers, code is almost invariably in flash - and thus cannot be directly overwritten.

About the only systems where it is generally possible to write to the code space without jumping through hoops (required for software updates, loading new programs, etc.) is if you have a system that has slow external flash, fast ram, and which copies the code from flash to ram at startup. Using an MPU to lock this code after loading is usually rather easy.

And the "C language" does /not/ compile to mixed-up messes. I explained about sections in a previous post - you claimed it was just the same as what you had written yourself, but more detailed. Either you didn't understand what I wrote, or you didn't understand what you wrote yourself. Either way, you clearly don't know how the C language or C compilers work, and are clearly unwilling to learn.

Reply to
David Brown
Loading thread data ...

I suppose I've been imagining tens of thousands of stack overflow and unchecked buffer exploits.

--

John Larkin         Highland Technology, Inc 

lunatic fringe electronics
Reply to
John Larkin

At school O-level exams we had early multiple-choice exams where there were two statements, A and B, and you had to choose between:

1 A and B are true, and B is the reason for A 2 A and B are true, and B is not the reason for A 3 A is true, and B is false 4 A is false, and B is true 5 A is false, and B is false

While I'm no longer a fan of C or C++, I think "2" is the appropriate answer in this case.

Reply to
Tom Gardner

On Friday, December 28, 2018 at 2:40:21 PM UTC-5, snipped-for-privacy@downunder.com wr ote:

OMG, I can't believe in 2018 that this discussion of having 'go-to's' in co de is somehow justifiable. Over the last 35+ years there has been many many papers written that make numerous arguments of why they should not be used (portability, testability, maintainability, extensibility, etc...get the p oint? if not, look up software (or system) quality attributes. key word is 'quality') Cobol and the coding styles that grew out of it are (should be) dead, dead , dead. While the tricks may have been widely known and/or practiced, that doesn't make them right. If you think that using go-tos is somehow justifi able, one hasn't thought about the solution/or approach long enough. It doe sn't matter if one is programming in assembler or some HLL.

Reply to
three_jeeps

I like GOTOs, but then I program in state machines. Most programmers have never heard of state machines.

Dijkstra started the "goto is harmful" theory. He didn't program much himself and didn't have regular access to a computer.

--

John Larkin         Highland Technology, Inc 

lunatic fringe electronics
Reply to
John Larkin

I am with you here.

Being an avid asm programmer I use goto all the time :-) Why not, use labels that make sense helps. The idea of those having to be within readable range is silly, when programming I use search all the time.

I followed his advice and do not use goto in C, but then lately,,, I did anyway.

Who was it that said: 'Rules are made to be broken?'

There may be one thing that will destroy an empire, and that is it having too many rules, and too little common sense or understanding. Your enemies will exploit that.

And then again, I do not believe in security, anything and everything can be broken and have backdoors.

I was thinking say, now Intel bought Altera ? (IIRC) and that Intel Minix in X86 it would not be hard to sell an FPGA that monitors or even scans pins for data, and has an oscillator modulated by the data somewhere in the 4G or 5G range, and the hippies in that Volkswagen bus in front of your house recording your data.

No matter if you wrote your own cores or not? Does that rule out Altera now? And that is an EASY hack. Xilinx is also a 100% US company IIRC.

Reply to
<698839253X6D445TD

"Gotos considered harmful" persists because people grading lab code can grep for "goto" easily.

For high-reliability code, it's *all* housebroken "gotos". High-rel is event-driven, state-machine logic. Raw imperative and OO code has been running as fast as it can *way* from that paradigm.

Software as a discipline is failing as fast as it can. People would throw their children into vocanoes before they'd make something proveable, even mildly, informally proveable.

You show it to them and they nearly start screaming....

--
Les Cargill
Reply to
Les Cargill

ITYM there have been a lot of religious wars about it. ;) It basically comes down to GOTO being an invitation to write spaghetti code. Everybody agrees that spaghetti code is bad. (Everybody except LabView programmers, I mean.) ;)

But you can push that too far. Say you have a loop nested six deep, because a six-dimensional data structure is natural for your problem. If you encounter a divide-by-zero, or the computation ends early for some reason such as a zero row in a matrix, you need to get out of all six loops. There's no special language construct for that.

Your options are:

  1. Throw an exception, if you're using C++. That's okay if your situation is actually exceptional, i.e. it isn't the normal way of exiting. All previous work in the current try{} block is lost, but all the local objects get destructed properly.

  1. Set a flag and test for it in each loop control statement, so that you exit them all in turn. This is what the "GOTO considered radioactive" folks usually recommend. But that destroys a lot of loop optimizations on account of the complicated control expression, and is easy to get wrong--you have to be sure to test in the correct place in each loop, and some maintenance programmer can easily break that. Similarly, break statements have to be chained correctly.

  2. Put a named label right after the closing brace of the outer loop, and GOTO there from wherever the problem surfaces. That's not spaghetti: it's easy to understand, hard to screw up, and preserves loop optimizations. It'll probably result in a pipeline stall, but that's as bad as it gets.

#3 for me any old day.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
ElectroOptical Innovations LLC / Hobbs ElectroOptics 
Optics, Electro-optics, Photonics, Analog Electronics 
Briarcliff Manor NY 10510 

http://electrooptical.net 
http://hobbs-eo.com
Reply to
Phil Hobbs

One UCLA prof knocked off one letter grade per GOTO.

--

John Larkin         Highland Technology, Inc 
picosecond timing   precision measurement  

jlarkin att highlandtechnology dott com 
http://www.highlandtechnology.com
Reply to
John Larkin

Am 30.12.18 um 18:57 schrieb John Larkin:

You say that as if it was related in any way.

My VHDL state machines work nicely without gotos. I'd like to change a thousand things in VHDL, but adding goto is not one of them.

I must admit that I like longjump() in case of a clusterf*ck.

The people at AT&T, where C, yacc, lex, Unix, etc originated worked on compiling state machines formulated as grammars / regular expressions to silicon via stick languages. That's why there is yacc.

The pattern matcher awk was written by Aho, Weinberger & Kernighan to create a state machine that scans some inputs.

Weinberger is the inventor of the Weinberger arrays, a logic block like a PAL, but earlier, programmable at layout-generation time and more flexible. Just add the registers and you have a state machine.

Kernighan was also the author of the original portable C compiler.

This Kernighan:

<
formatting link
>

You seem to be funny now and then.

cheers, Gerhard

Reply to
Gerhard Hoffmann

If you start with thousands of vulnerabilities, and keep adding new ones, finding and patching them will certainly be a process.

x86 and c are over 40 years old. Linux is 27 years old. Will we be using them for the next 100 years?

--

John Larkin         Highland Technology, Inc 
picosecond timing   precision measurement  

jlarkin att highlandtechnology dott com 
http://www.highlandtechnology.com
Reply to
John Larkin

What do you mean by "housebroken"?

If you use the appropriate design patterns, FSMs can and are routinely expressed extremely cleanly and efficiently in OO languages.

Of course it is possible to avoid good design patterns and write brittle crap. No change there.

Indeed. I've provoked such a reaction myself by showing a networking FSM to people that were actively researching proving properties of FSMs.

But that isn't entirely their fault: state-space explosion is a real and probably intractable problem.

Reply to
Tom Gardner

Am 30.12.18 um 20:48 schrieb Phil Hobbs:

  1. Use setjmp() to define a friendly environment for recovery and use longjmp() to return from $WHATEVER_MISHAP.

Gerhard

Reply to
Gerhard Hoffmann

Okay, that's C's rough-and-ready version of (1). There are other reasons for exiting loops early.

Cheers

Phil Hobbs

(Who has written a lot of C/C++ but has never used longjmp.)

--
Dr Philip C D Hobbs 
Principal Consultant 
ElectroOptical Innovations LLC / Hobbs ElectroOptics 
Optics, Electro-optics, Photonics, Analog Electronics 
Briarcliff Manor NY 10510 

http://electrooptical.net 
http://hobbs-eo.com
Reply to
Phil Hobbs

Dennis Ritchie wrote it - the first big piece of software I ever dug in to understand.

Together they wrote Unix. The source code for Unix used to be under two main directories, named "dmr" (for guess-who?) and "bk". "dmr" had all the device drivers, because he was the hardware guy of the pair.

Clifford Heath.

Reply to
Clifford Heath

No, the stack overflows and unchecked buffer exploits are real. Your confusion lies in thinking that this is because "C mixes up code and data", and that people don't use MMU's or MPU's. (I've been assuming you know what these are, and what they do. Perhaps that is an unwarranted assumption.)

If you would like me to explain how these kinds of exploits work, and why they are nothing to do with mixing code and data (whether it really happens, or is only in your mind), I can tell you. If you want to listen and learn.

Reply to
David Brown

y

as

p
I

re

I'd

es.

code is somehow justifiable.

John Larkin seems to live in some kind of parallel universe, rather loosely linked to ours. I got taught about state machines in Theory of Computation part 1 back in 1966, which was a first year course (though I was taking it as a graduate student).

formatting link

John Larkin's parallel universe seems to be a long way from ours.

He was a programmer - the first person to have the title in the Netherlands - from 1952. Presumably there was at least one computer in the department to which that he did have regular access - it sounds as if was one they'd built themselves, but the documentation that google throws up is in Dutch, so I won't bother posting the links.

"the Computation Department at the Mathematical Center in Amsterdam, who of fered Dijkstra a job; he officially became the Netherlands' first "programm er" in March 1952."

--
Bill Sloman, Sydney
Reply to
bill.sloman

te:

a

t 2? Or pi?

utable...

d

The alphabet and the wheel are rather older. The x86 is to computing hardwa re what the Chinese syllable-writing system is to a proper phoneme-based al phabet, but the Chinese are still using their hard-to-remember syllable sym bols. "C" seems to be more nearly adequate as a computer language. "Linux" is more a social movement than anything else, but some social movements do last, particularly when they perform a service that people need.

--
Bill Sloman, Sydney
Reply to
bill.sloman

Sorry, that should have been "ken" for Ken Thompson.

Also, per , " Kernighan affirmed that he had no part in the design of the C language ("it's entirely Dennis Ritchie's work"). "

Reply to
Clifford Heath

formatting link

--

John Larkin         Highland Technology, Inc 

lunatic fringe electronics
Reply to
John Larkin

ElectronDepot 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.