Recent

Author Topic: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.  (Read 2330 times)

Ten_Mile_Hike

  • New Member
  • *
  • Posts: 44
I never use "Try Except Finally"  in my code and I
don't read the documentation unless my code fails
compilation.

Go ahead and roast me...I can take it.
I will ask Niklaus Wirth for forgiveness in my prayers tonight.

kapibara

  • Hero Member
  • *****
  • Posts: 610
I have stored rows of text without commenting them out in the space after the units end.
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
I have written procedures that span over countless screens.
Conscience is the debugger of the mind

Thaddy

  • Hero Member
  • *****
  • Posts: 14215
  • Probably until I exterminate Putin.
Despite Wirth's intentions, I confess I often write bad code....(not THAT often)
In my days as an assistent teacher at university in 1981 (USCD PASCAL, APPLE II, but also Algol Vax/Vms) I seem to have been more careful? Dunno why, but I got some of it back...
« Last Edit: August 07, 2022, 11:15:57 am by Thaddy »
Specialize a type, not a var.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
I sometimes use GOTO inside a CASE to simulate C-style behaviour:

Code: Pascal  [Select][+][-]
  1.  
  2. case ParamCount() of
  3.   1: begin
  4. // Special handling here for the one-parameter case, e.g. --help and --version.
  5. oneParam:
  6.         option(ParamStr(1))
  7.       end;
  8.   2: begin
  9. twoParam:
  10. // Special handling here for the two-parameter case.
  11.         option(ParamStr(2))
  12.         goto oneParam
  13.       end;
  14. ...
  15.  

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dseligo

  • Hero Member
  • *****
  • Posts: 1196
I use global variables.

Thaddy

  • Hero Member
  • *****
  • Posts: 14215
  • Probably until I exterminate Putin.
I use global variables.
I use local typed consts... I win?  ::)
Specialize a type, not a var.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
I use global variables.

So do the Lazarus developers: that's how IDE forms are stored.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Josh

  • Hero Member
  • *****
  • Posts: 1271
not commenting important/complex code
not putting TODO in code  ( go on a break and you've forgot what is left )
using shortened /abbreviated names for variables and procedure (no idea what they mean later on)
and the opposite using long similar names for var/proc/func.
  MyComplexFunctionForAdding,MyComplexFunctionForDividing, takes forever to find them in codecomplettion, when
  AddMyComplexFunction,DivideMyComplexFunction comes up within a fewkeypresses.
Badly formatted code  that is hard  to   follow.
Using extended chars directly in strings (may not show if you edit on another system);
Using others peoples code snippets (unless you fully understand the logic and flow).


The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Kays

  • Hero Member
  • *****
  • Posts: 569
  • Whasup!?
    • KaiBurghardt.de
Re: My confession – I am a Pascal sinner.
« Reply #9 on: August 07, 2022, 12:30:06 pm »
Forgive me, padre, but I have sinned with another programming language, producing lots of dirty code. I mean, I love Pascal, but then you see this new, young programming language… I feel repentant and have already begun programming a new piece of software just in Pascal.
Yours Sincerely
Kai Burghardt

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
I "do" Pascal.

Thaddy

  • Hero Member
  • *****
  • Posts: 14215
  • Probably until I exterminate Putin.
I "do" Pascal.
Yeah, right, with C quotes... Unacceptable on this forum.
Then again I always mix up C code with Pascal comments........
Specialize a type, not a var.

Awkward

  • Full Member
  • ***
  • Posts: 135
OMG! i found my sins! Macroses! like
Code: Pascal  [Select][+][-]
  1.   {$IFDEF MSWINDOWS}
  2.     {$DEFINE WinAPI := stdcall}
  3.   {$ELSE}
  4.     {$DEFINE WinAPI := cdecl}
  5.   {$ENDIF}
  6.  
or
Code: Pascal  [Select][+][-]
  1. const
  2.   CompileInfo = 'Compiled at '+{$I %DATE%}+' '+{$I %TIME%}+' with FPC v.'+{$I %FPCVERSION%};
  3.  
and i even has fun with experiment with SQLite.inc file view:
Code: Pascal  [Select][+][-]
  1. {$MACRO ON}
  2. {$IFDEF S}
  3.   {$DEFINE declareproc:=procedure}
  4.   {$DEFINE asproc:=}
  5.   {$DEFINE declarefunc:=function}
  6.   {$DEFINE asfunc:=}
  7.   {$DEFINE doexternal:=external Sqlite3Lib;}
  8. {$ELSE}
  9.   {$DEFINE declareproc:=var}
  10.   {$DEFINE asproc:=: procedure}
  11.   {$DEFINE declarefunc:=var}
  12.   {$DEFINE asfunc:=: function}
  13.   {$DEFINE doexternal:=}
  14. {$ENDIF}
  15. // original
  16. {$IFDEF S}function{$ELSE}var{$ENDIF}sqlite3_declare_vtab_1{$IFDEF D}: function{$ENDIF}
  17.   (db: pchar; zCreateTable: pansichar): integer; cdecl;{$IFDEF S}external Sqlite3Lib;{$ENDIF}
  18.  
  19. declarefunc sqlite3_declare_vtab_2 asfunc (db: pchar; zCreateTable: pansichar): integer; cdecl; doexternal
  20.  
but really, i don't use it too actively

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
@Awkward: Nothing wrong with macros and predefined substitutions per se.

You would, OTOH, be living dangerously if you added your voice to those who complain that macros should support parameters >:-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11384
  • FPC developer.
OMG! i found my sins! Macroses! like
Code: Pascal  [Select][+][-]
  1.   {$IFDEF MSWINDOWS}
  2.     {$DEFINE WinAPI := stdcall}
  3.   {$ELSE}
  4.     {$DEFINE WinAPI := cdecl}
  5.   {$ENDIF}
  6.  

Your sin is doing it manually, while it is a builtin feature

 

TinyPortal © 2005-2018