Hallo User, ein besch... Tool

  • 1
  • 2
  • 3
  • 4
  • 5
  • Page 5 of 5
miparo
Administrator
Avatar
Gender:
Location: Germany
Age: 59
Posts: 956
Registered: 09 / 2007
Subject:

Re: Hallo User, ein besch... Tool

 · 
Posted: 23.07.2018 - 00:00  ·  #33
Sauber erläutert.

Und ich kenne auch keine Firma die im Produktiven Einsatz Arduino oder andere OpenSource Compiler benutzen würde.
Hier wird mehr auf Sicherheit und Beständigkeit Wert gelegt und da haben 2k Compiler/IDE's ihr Nischen.

Und C ist ja auch nur einfach eine Hochsprache, die man "Sauber" schreiben kann.
Code

 // so schreiben ich es in C damit ich es in ein paar Jahren noch lesen kann
if (a > b) {
    result = x;
}
else {
    result = y;
}

// Ein C-Freak pinselt es so
result = a > b ? x : y;



Und wenn ich dann noch veruche verschiedene Speicherbereiche in GCC zu definieren, da stehen mir die Haare zu Berge mit PROGMEM und all so wirren Bezeichnung.

Und wenn man sich sich 90% der GitHub / Arduino Samples anschaut:
Sie funktionieren einfach nur aber das war es auch.

Aber wie gesagt: Für alle Hobby Programmierer sind dieses Compiler auch nicht gedacht, was schon der Preis ausschließt - den ich selsbt fragwürdig finde.

Es ist auf dem freien Markt zum Glück für jeden was dabei.
ALLE Compiler haben so ihre Vor & Nachteile.

miparo
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1373
Registered: 03 / 2005
Subject:

Re: Hallo User, ein besch... Tool

 · 
Posted: 23.07.2018 - 10:47  ·  #34
You always have to be a bit careful comparing C and Pascal, because you are not really comparing like with like. For example, during initialsation, in AVRCo variable are initialised to zero. In C that operation is simply missing.

Similarly in loops, AVRCo does boundary checking, but C does not.

Another thing to be aware of is that I specifically do not do all optimisations on the system area, at Rolf's request, so there are sometimes gains to be made there that are not done. For example, some functions have multiple options, but only one path is executed. Typically variations account for pointers to different spaces (EEPROM/RAM/FLASH) where only one is actually used.

I did a poll at one stage to see whether loops with global variables should be optimised the way local variables are, and the answer came back 'no', so some optimisations are possible but deemed to be not worth it.

Like Rolf, I prefer safety first, so sometimes I do not do an optimisation because is is theoretically possible that a variable could changed where in practice it does not.

But I am always looking for new optimisation ideas, and any suggestions are always welcome, even if sometimes they turn out not to be practical.
  • 1
  • 2
  • 3
  • 4
  • 5
  • Page 5 of 5
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 13   50   63 · Page-Gen-Time: 0.019661s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI