Hallo User, ein besch... Tool

  • 1
  • 2
  • 3
  • 4
  • 5
  • Seite 5 von 5
miparo
Schreiberling
Avatar
Geschlecht:
Herkunft: Germany
Alter: 59
Beiträge: 988
Dabei seit: 09 / 2007
Betreff:

Re: Hallo User, ein besch... Tool

 · 
Gepostet: 23.07.2018 - 00:00 Uhr  ·  #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
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: Hallo User, ein besch... Tool

 · 
Gepostet: 23.07.2018 - 10:47 Uhr  ·  #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
  • Seite 5 von 5
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 8 · Cache Hits: 14   51   65 · Page-Gen-Time: 0.015522s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI