Delphi-PRAXiS
Seite 51 von 53   « Erste     41495051 5253      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Klatsch und Tratsch (https://www.delphipraxis.net/34-klatsch-und-tratsch/)
-   -   Eure besten Quellcode Kommentare... (https://www.delphipraxis.net/96226-eure-besten-quellcode-kommentare.html)

dummzeuch 14. Feb 2020 13:09

AW: Eure besten Quellcode Kommentare...
 
Zitat:

Zitat von Luckie (Beitrag 1457488)
Interessant. Ab welchem Delphi ist das verfügbar?

Wenn Du Win32Check meinst:
Das habe ich schon mit Delphi 3 verwendet, mich würde nicht wundern, wenn es auch in Delphi 2 schon existierte. (In Delphi 1 gab es soweit ich weiß keine Exceptions.)

DeddyH 14. Feb 2020 13:15

AW: Eure besten Quellcode Kommentare...
 
Zitat:

Zitat von dummzeuch (Beitrag 1457519)
(In Delphi 1 gab es soweit ich weiß keine Exceptions.)

Doch, gab es ;-)

Codehunter 14. Feb 2020 16:59

AW: Eure besten Quellcode Kommentare...
 
Zitat:

Zitat von DeddyH (Beitrag 1457521)
Zitat:

Zitat von dummzeuch (Beitrag 1457519)
(In Delphi 1 gab es soweit ich weiß keine Exceptions.)

Doch, gab es ;-)

Hießen die damals noch Regeln bevor sie zu Ausnahmen wurden? :lol:

Luckie 15. Feb 2020 09:05

AW: Eure besten Quellcode Kommentare...
 
Ich war auch etwas offtopic. Aber ich denke, wir sollten wieder zum eigentlichen Thema zurückkommen und in dem geht es um Quellcodekommentare, um das noch mal in Erinnerung zu rufen.

Der schöne Günther 17. Sep 2021 10:41

AW: Eure besten Quellcode Kommentare...
 
Variablen gute Namen zu geben ist auch gute Kommentierung, aber das sieht so spooky aus, das traue ich mich erst gar nicht anzufassen. Warum Sleep 0? Und warum "wharrgarbl"? Eine Bildersuche nach dem Begriff lässt mich nur noch verwirrter zurück...

Delphi-Quellcode:
const
   WHARRGARBL = 0;
begin
   TTask.Run(
      procedure()
      begin
         TThread.Sleep(WHARRGARBL);
         TThread.Queue(
            TThread.CurrentThread,
            procedure()
            begin
               runPageAdjustments();
            end
         );
      end
   );
   // TODO und was ist wenn man es vor ablauf wieder schließt?
end;

Rollo62 17. Sep 2021 10:52

AW: Eure besten Quellcode Kommentare...
 
Zitat:

Zitat von Der schöne Günther (Beitrag 1495047)
Delphi-Quellcode:
const
   WHARRGARBL = 0;

Das ist doch mal ein schöner "sprechender Name", der den aktuellen Gemütszustand des Programmierers ausdrückt :stupid:

Codehunter 17. Sep 2021 11:16

AW: Eure besten Quellcode Kommentare...
 
Zitat:

Zitat von Der schöne Günther (Beitrag 1495047)
Warum Sleep 0?

Spontane Idee: War mal <> 0 zum Testen und wurde irgendwann auf 0 gesetzt anstatt die Zeile ganz zu entfernen.

Uwe Raabe 17. Sep 2021 11:30

AW: Eure besten Quellcode Kommentare...
 
Zitat:

Zitat von Der schöne Günther (Beitrag 1495047)
Warum Sleep 0?

Das kann schon seinen Sinn haben. Das Sleep ist ja unter Windows intern auf die gleichnamige Windows-Routine verdrahtet und dazu sagt MSDN:
Zitat:

A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution. Windows XP: A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. This behavior changed starting with Windows Server 2003.

Medium 17. Sep 2021 12:08

AW: Eure besten Quellcode Kommentare...
 
Jap, das ist genau warum ich das auch gerne mal einsetze. Sonst schnappt sich ein Thread der sonst auf nichts wartet nämlich einfach mal 100% CPU Auslastung.

Der schöne Günther 17. Sep 2021 12:25

AW: Eure besten Quellcode Kommentare...
 
Dann hätte man aber auch
Delphi-Quellcode:
TThread.Yield()
sagen können anstatt
Delphi-Quellcode:
WHARRGARBL
- glaube ich.


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:29 Uhr.
Seite 51 von 53   « Erste     41495051 5253      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz