Author Topic: while loop in software  (Read 64848 times)

0 Members and 2 Guests are viewing this topic.

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: while loop in software
« Reply #125 on: December 20, 2014, 02:17:41 am »
More likely than not C is why Sony Pictures is being destroyed. More likely than not C is why a German steel mill has a load of scrap on it's hands where they once had expensive machinery. C is a weapon of mass destruction.

The idea that these issues would go away if people stopped using C is cute.

BTW, is VB even a language? :-D
It's not even portable :palm:

Nor potable, which is what I first read.

Seriously, I don't recommend it.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6686
  • Country: nl
Re: while loop in software
« Reply #126 on: December 20, 2014, 02:22:13 am »
The idea that these issues would go away if people stopped using C is cute.

Criminals are not immune to the cost-benefit principle.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6189
  • Country: us
Re: while loop in software
« Reply #127 on: December 20, 2014, 02:43:28 am »
I don't hate C.  I hate that C devs flatly reject advances in software development. 

I also hate behavior just like what you just typed up.  Dismissal of my point of solely because it does not match your own.

Rigby, what language would you recommend for programming small MCU's instead of C/C++?
 

Offline vvanders

  • Regular Contributor
  • *
  • Posts: 124
Re: while loop in software
« Reply #128 on: December 20, 2014, 03:19:48 am »
More likely than not C is why Sony Pictures is being destroyed. More likely than not C is why a German steel mill has a load of scrap on it's hands where they once had expensive machinery. C is a weapon of mass destruction.
That's the biggest crock I've heard. If you took 2 seconds to look into the issue you'd see that it's the result of spear phishing: http://arstechnica.com/security/2014/12/computer-intrusion-inflicts-massive-damage-on-german-steel-factory/

There are many high level languages that do what you want. If you want bounds checking use them. There's a reason for C's success and if programming was easy then none of us would have jobs.
 

Offline Rigby

  • Super Contributor
  • ***
  • Posts: 1476
  • Country: us
  • Learning, very new at this. Righteous Asshole, too
Re: while loop in software
« Reply #129 on: December 20, 2014, 03:58:45 am »

Rigby, what language would you recommend for programming small MCU's instead of C/C++?

Not a lot of choice, is there.  Since all of you are so blindly in love with C to even admit it has issues, I don't see that ever changing. 

 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: while loop in software
« Reply #130 on: December 20, 2014, 04:00:47 am »
Oh I see, this is one of those hypothetical, Wouldn't It Be Nice If arguments.

I want a unicorn.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline Rigby

  • Super Contributor
  • ***
  • Posts: 1476
  • Country: us
  • Learning, very new at this. Righteous Asshole, too
Re: while loop in software
« Reply #131 on: December 20, 2014, 04:05:36 am »
The idea that these issues would go away if people stopped using C is cute.

Who said that these issues would go away?  I didn't.  Would disuse of C for certain things mitigate these issues a bit?  You and I both know that it would.

That's all I'm trying to say -- C is NOT the ultimate language in its current form, and I'm getting a hell of a lot of resistance on that.  I don't understand why.  I'm saying "hey, things could be better if a few of us wanted that" and it feels like I'm getting back something like "fuck Rigby, am I right, haha what a loser!  Try VB, LOSER! LOL" 
 

Offline Rigby

  • Super Contributor
  • ***
  • Posts: 1476
  • Country: us
  • Learning, very new at this. Righteous Asshole, too
Re: while loop in software
« Reply #132 on: December 20, 2014, 04:11:58 am »
Oh I see, this is one of those hypothetical, Wouldn't It Be Nice If arguments.

I want a unicorn.
I never said that there were alternatives today... I said that languages have advanced and C has not.  I said things could be better.

Now, you're telling me that because no alternative exists right this moment that my wish for a better fucking development paradigm for micros is like wishing for a unicorn?

What the FUCK are you people smoking?
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: while loop in software
« Reply #133 on: December 20, 2014, 04:37:24 am »
I have no problem with what you claim to be saying, it's what you are saying in between those claims that's absurd...
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline Rigby

  • Super Contributor
  • ***
  • Posts: 1476
  • Country: us
  • Learning, very new at this. Righteous Asshole, too
Re: while loop in software
« Reply #134 on: December 20, 2014, 04:54:18 am »
Here's a potential replacement for C on micros.

http://dlang.org/comparison.html

I don't know much about this language, yet, but it is open source, uses C-like syntax, doesn't use pointers except when they are NEEDED, allows direct access to hardware, and compiles to machine code, just like C.

So here we have something that shows promise, and could prevent a lot of errors that are prone to happen with C. 

Now, quick; tell me what a jackass I am and how wrong I am.  Rise up and strike me down, and your transformation into a high school cheerleader clique will be complete.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: while loop in software
« Reply #135 on: December 20, 2014, 06:31:08 am »
Sounds a lot like Turbo Pascal, 31 years ago.

Only sort of kidding.

That is how it was marketed. Strong typing. No pointers except where needed. Strings with lengths at the start, bounds checking on arrays better modularity, all the speed of C, a better language for system-level work.

It was also much admired by teachers for doing things 'the right way' and used in tertiary courses (like Java was 10 years ago... what do they use now???).

I sort of liked ir.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6189
  • Country: us
Re: while loop in software
« Reply #136 on: December 20, 2014, 07:40:29 am »

Rigby, what language would you recommend for programming small MCU's instead of C/C++?

Not a lot of choice, is there.  Since all of you are so blindly in love with C to even admit it has issues, I don't see that ever changing.

There are non C/C++ languages that are popular when programming real computers so possibly the issue is not that people don't accept better languages but that low level language such as C/C++ are the best fit for microcontrollers.

Electric Imp for example support a higher level language (at least when it comes to memory management) most likely so they can sandbox user's programs but I would guess that they use C/C++ for their own stuff.  https://electricimp.com/docs/squirrel/squirrelcrib/
 

 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5313
  • Country: gb
Re: while loop in software
« Reply #137 on: December 20, 2014, 08:37:47 am »
Sounds a lot like Turbo Pascal, 31 years ago.

Only sort of kidding.

That is how it was marketed. Strong typing. No pointers except where needed. Strings with lengths at the start, bounds checking on arrays better modularity, all the speed of C, a better language for system-level work.

It was also much admired by teachers for doing things 'the right way' and used in tertiary courses (like Java was 10 years ago... what do they use now???).

I sort of liked ir.

I wrote an awful lot of Turbo Pascal back in the day, not just on the PC but they had a Mac version too in the end. Knocked spots off the competitors for performance, remember this was a time when many PCs didn't even have a hard drive, everything was stored on floppies. Borland stored everything, the IDE, the source code and the compiled program in RAM to massively improve development time. Microsoft had a Pascal compiler that was dog slow because ot relied on disk for everything. Later on, when doing C, I used to develop everything in the super fast Borland Turbo C IDE and then, when ready, recompile later in the uber slow Microsoft C, the choice of my employer.

Anyone remember that dog slow, almost unuseable, Programmer's Workbench (PWB) that Microsoft brought out in answer to Borland's IDE? Microsoft just didn't get it.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7673
  • Country: de
  • A qualified hobbyist ;)
Re: while loop in software
« Reply #138 on: December 20, 2014, 09:15:35 am »
I've written code in assembler, Basic, Pascal, Modula, Comal, C, C++, unix shell scripts, awk scripts, DOS batch scripts, Java, perl, PHP and some stuff more, but I'm still happy with C. And because I know C's weaknesses, I know how to deal with them. Sometimes those weaknesses are quite useful to solve a problem in a simple way. The same applies to other languages as well. But you'll find out that a secure and idiot-proof language makes programming cumbersome and programs slow.
« Last Edit: December 20, 2014, 12:53:32 pm by madires »
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: while loop in software
« Reply #139 on: December 20, 2014, 10:15:03 am »
Here's a potential replacement for C on micros.
http://dlang.org/comparison.html
...
Yeah, but will anybody care to write a D compiler for ARM, for Atmel, for Freescale's  PowerPC (Esys) cores or even more obscure stuff (Infinion Tricore or Freescale eTPU)?
Writing/adapting a compiler for a specific core architecture is not an easy task. Optimization strategies differ, pipeline effects have to be considered and so on. Even between cores of the same family, the command set differs. There are even cores with two switchable instruction sets, dedicated SIMD or floating point engines with very specific implementations etc.
The only reason that we can develop for ARM and Atmel with freely available compilers is that C was and is of such importance that GCC was started as open source project.
Anyway, in industrial applications with safety to consider, you usually want to use a compiler which has certain certifications and guarantees to work around known errata of the supported cores.
This means though that some software vendor like BlueRiver and the likes is interested to develop that compiler for you - which they only do if there is enough demand for it.
And honestly, for the next ten years to come, the Demand for C/C++ will be much higher than for somewhat exotic languages like D or Rust or whatever.

So on a microcontroller it's not like on the PC where you can decide freely which language to choose for a project. In the end you kinda need to use C since there is simply no other (stable, robust, certified, performant) other compiler available. The only chance would be to use a higher level language or symbolic tool that creates C code which then needs to be compiled by the default C compiler. Problem is that this increases build time and makes it very hard to debug. Also chance of tool/compiler errors increases.
Trying is the first step towards failure - Homer J. Simpson
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3231
  • Country: gb
Re: while loop in software
« Reply #140 on: December 20, 2014, 10:21:58 am »
I see what computers can do, and I see how C is very much unchanged in so many ways after over 40 years.

Fashions come and go, but style is forever.

Computers are supposed to aid us.  With C, the computer just gets in the way, lets you lay little traps that no one will notice for years, and almost aids developers in making mistakes.  My primary complaint about that is that NO ONE SEEMS TO CARE.  Virtually every C developer I've known, when I mention how easy common mistakes are, they respond with something like "yeah, so don't do that."  You're sitting at a computer which was partially DESIGNED to detect errors that humans are prone to make and we still rarely use them to detect errors that humans are prone to make, purely because we each have so much misplaced confidence in our own abilities. 

The result is that every new C developer makes these mistakes again and again, and we constantly hear about code that is vulnerable to buffer overflow or memcopy exploits or whatever the bug du jour is lately.

We could use the computer to aid us as C developers, yet we choose not to.  This is my complaint.  We are so full of ourselves to think if we just remember not to do a bad thing that no bad things will happen in our code.

So you are suggesting someone invents a utopian language that won't permit the programmer to make any mistakes, and yet gives the runtime performance as C? Sounds great, why don't you do it?  You'd certainly make a lot of money.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26682
  • Country: nl
    • NCT Developments
Re: while loop in software
« Reply #141 on: December 20, 2014, 11:01:41 am »
No embedded Lua? At least Lua seems way more mainstream than D.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11518
  • Country: my
  • reassessing directives...
Re: while loop in software
« Reply #142 on: December 20, 2014, 12:26:45 pm »
go for visual basic 6 my friend... it has array bound check in every compile option, your problem solved!
Every C compiler has a bounds check flag you can enable if you want.
BTW, is VB even a language? :-D
It's not even portable :palm:
---
Daniel
VB hateboy (linux/mac/c fanboy) joining the club, welcome!... yes VB is a language, you seem to miss what a "language" means. and i'm guessing you are the new guy or never code in VB, never link it to external C/asm (read as super fast and efficient) code/dll, and never get the idea that there is/are few VB IDE for micros, never appreciate how hard the hundreds lines of code just for windows creation and events handling etc... granted there is no VB for linux or mac because VB was invented by the "BIG" guy from M$$$$. mac & linux are small, if it aint for W$$$ i'm not buying :P :P :P you taste what? lemon? :P

edit: and i dont need to be portable because i can live without linux and mac. and portabilitty is not something you embed or as a criterion in a language, it can be important for the success of a particular language, but not that important to decide whether one is a language or not. portability is about people providing platform or IDE / compiler for the particular machine. if the big guy decided VB to be portable, they will build the IDE for other OS, but they opt to not to. if no one is building java distribution for windows, java app will not even be portable to windows, you feel that?
« Last Edit: December 20, 2014, 12:35:21 pm by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4064
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: while loop in software
« Reply #143 on: December 20, 2014, 12:44:09 pm »
C is for advanced programmers. Go play with Java or Microsoft Java (C#) if you want rubber matting all around.
Instead of being lazy and fixing the result of your mistakes, go and fix your mistakes, please.

(already 10 pages of  :rant: on while loops, intriguing)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: while loop in software
« Reply #144 on: December 20, 2014, 12:47:52 pm »
Quote
C is for advanced programmers.

Depending on what you meant by "advanced". I consider those working on Android / IOS everybit as advanced, if not more.

Quote
(already 10 pages of  :rant: on while loops, intriguing)

Yes, and more importantly, amazing.

That's the (most?) interesting thing about dealing with engineers - everything is black and white and answers must be right or wrong.

So simpleton.
================================
https://dannyelectronics.wordpress.com/
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11518
  • Country: my
  • reassessing directives...
Re: while loop in software
« Reply #145 on: December 20, 2014, 01:02:53 pm »
Quote
(already 10 pages of  :rant: on while loops, intriguing)
Yes, and more importantly, amazing.
let me hint you the list...
1) religion
2) computing theology... trolls to linux vs windows / c vs others flamewar (this thread)
3) free energy
4) dso hacking thread
5) audiophoolery
sort of...
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6686
  • Country: nl
Re: while loop in software
« Reply #146 on: December 20, 2014, 01:48:02 pm »
That's the biggest crock I've heard. If you took 2 seconds to look into the issue you'd see that it's the result of spear phishing: http://arstechnica.com/security/2014/12/computer-intrusion-inflicts-massive-damage-on-german-steel-factory/

Phishing gets them on a system, but they will generally want to elevate their privileges ... you don't really want to target the sysadmins directly. Local exploits almost certainly played their part.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: while loop in software
« Reply #147 on: December 20, 2014, 01:50:14 pm »
thing about dealing with engineers - everything is black and white and answers must be right or wrong.

You seem absolutely convinced this is true. Did it ever occur there is a less extreme viewpoint. That there may be a middle ground and it's not as clear cut as that?
« Last Edit: December 20, 2014, 02:21:46 pm by paulie »
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26682
  • Country: nl
    • NCT Developments
Re: while loop in software
« Reply #148 on: December 20, 2014, 02:04:35 pm »
C is for advanced programmers.
That is a load of crap. That is just like saying 'using a drill press without wearing safety glasses is what real men do'.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7673
  • Country: de
  • A qualified hobbyist ;)
Re: while loop in software
« Reply #149 on: December 20, 2014, 02:28:40 pm »
So we agree, that while() loops in C are a religious matter? >:D
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf