The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for February, 2021

Reminder: check if LUMC Privacy Statement and Gebruiksvoorwaarden are printable or downloadable as PDF.

Posted by jpluimers on 2021/02/26

Reminder to check out the results of this thread: [WayBack] Thread by @jpluimers: “Jammer dat het Privacy Statement op mijnlumc.lumc.nl/mijnlumc/?#/co… als een pop-up zichtbaar is, waardoor je het niet volledig kunt afdrukk […]”.

Related:

Thread:

Jammer dat het Privacy Statement op mijnlumc.lumc.nl/mijnlumc/?#/co… als een pop-up zichtbaar is, waardoor je het niet volledig kunt afdrukken of als PDF opslaan.

Vreemd ook dat de tekst op lumc.nl/12367/ anders is dan in de consent hierboven.

Kan @LUMC_Leiden dat oplossen?

Idem voor de Gebruiksvoorwaarden. Daar is geen alternatieve tekst van.
mentions In onderstaande code gaan de aanpassingen in beide <span>…</span> blokken zitten.

–jeroen

Read the rest of this entry »

Posted in Chrome, Development, LifeHacker, Power User, Software Development, Web Browsers, Web Development | Leave a Comment »

Nederlandse Sleutel- en Slotenspecialisten Gilde: Onze Leden

Posted by jpluimers on 2021/02/26

Voor noodvoorziening en glasvervanging: [WayBackGlasschade – AA Glas

[WayBack] Nederlandse Sleutel- en Slotenspecialisten Gilde: Onze Leden at the time of writing:

HBC Almere
Oslostraat 51
1334 CB Almere
Tel: 036-5499656
info@hbcalmere.nl
www.hbcalmere.nl
Keys for Cars Zeeland
Lingestraat 5
4335 NZ  Middelburg
Mob: 06-21936433
info@keysforcarszeeland.nl
www.keysforcarszeeland.nl
Amsterdams Sleutelpaleis
Muiderstraat 19
1011 PZ Amsterdam
Tel: 020-6226040
sleutelpaleis@hotmail.com
www.sleutelpaleis.nl
Slotenspecialist van Kessel
Tingietersgilde 16
3994 XP  Houten
Mob: 06-54933920
slotenspecialist@kpnmail.nl
www.slotenspecialistvankessel.nl
De Sleutelkoning
Haarlemmerdijk 19
1013 JZ Amsterdam
Tel: 020-6222630
info@desleutelkoning.nl
www.desleutelkoning.nl
Limburgse Sleutel Centrale
Grote Gracht 39
6211 ST  Maastricht
Tel: 043-3214559
info@sleutelcentralemaastricht.nl
www.sleutelcentralemaastricht.nl
De Sleutelspecialist Amsterdam
Prinsengracht 284a
1016 HJ Amsterdam
Tel: 020-6239869
info@desleutelspecialist.nl
www.desleutelspecialist.nl
De Sleutel Specialist Nijmegen
Groenestraat 209
6531 HG Nijmegen
Tel: 024-3502867
info@de-sleutelspecialist.nl
www.de-sleutelspecialist.nl
Jutkey Sleutel- en Slotentechniek
Pleimuiden 12a
1046 AG Amsterdam
Tel: 020-6169455
info@jutkey.nl
www.jutkey.nl
Sleutelcentrale Toller BV
Goudsesingel 45
3031 ED Rotterdam
Tel: 010-4118217
sleutel.centrale@wxs.nl
www.sleutelcentrale.nl
De Sleutel- en Slotenspecialist B. Bosman
Johan de Wittlaan 19
6828 XB Arnhem
Tel: 026-4421247
bosman@bosmansleutels.nl
www.bosmansleutels.nl
Aanpak & Lockit Slotenmaker
Emmy van Leersumhof 20
3059 LT Rotterdam
Tel: 010-2222559
info@lockit.nl
www.lockit.nl
Van den Hoogen Security
Bruningweg 4
6827 BM Arnhem
Tel: 026-3610909
info@vdhoogen.nl
www.vdhoogen.nl
Moonen Sleutel-Service
Piusstraat 313
5038 WR Tilburg
Tel: 013-5430579
info@moonensleutelservice
www.moonensleutelservice.nl
Safe Beveiliging
Zwolseweg 40-46
2994 LB Barendrecht
Tel: 0180-654555
info@safe-beveiliging.nl
www.safe-beveiliging.nl
Bartels Sloten & Sleutelspecialist
Leutherweg 55-57
5915 CB Venlo
Tel: 077-3511641
info@bartels-sloten.nl
www.bartels-sloten.nl
De Sleutelspecialist Van den Acker
Ginnekenweg 56
4818 JB Breda
Tel: 076-5142561
info@sleutelspecialistbreda.nl
www.ackerbv.nl
Waterland Beveiligings Techniek
Dieselstraat 3
1131 JZ Volendam
Tel: 0299–320140
mail@waterlandbeveiliging.nl
www.waterlandbeveiliging.nl
De Sleutelkoning
Dorpsstraat 58
1906 EM Castricum
Tel: 025-1652524
castricum@desleutelkoning.nl
www.desleutelkoning.nl
Swier IJmuiden
Plein 1945 nr. 51
1971 GC IJmuiden
Tel: 0255-513651
info@swier.nl
www.swier.nl
Slotenexpert Meijering
Nagelerweg 12
8304 AB Emmeloord
Tel: 0527-612477
info@slotenexpert.nl
www.slotenexpert.nl
De Sleutelspecialist Adema & Zn.
Laarstraat 13
7201 CA Zutphen
Tel: 0575-515565
info@adema-sleutelspecialist.nl
www.adema-sleutelspecialist.nl
De Sleutelspecialist Adema & Zn.
Lipperkerkstraat 31
7511 CT Enschede
Tel: 053-4311490
info@adema-sleutelspecialist.nl
www.adema-sleutelspecialist.nl
Sleutel- en Slotenservice Zwijndrecht
Burg. De Bruinelaan 131a
3331 AD Zwijndrecht
Tel: 078-6124342
sleutelservice@chello.nl
www.sleutel-service.nl
Sleutelcentrale
Westersingel 5
9718 CA Groningen
Tel: 050-3133601
info@desleutelcentrale.nl
www.desleutelcentrale.nl
Sleuteldienst B.V.
Spiegelstraat 2
8011 VE Zwolle
Tel: 038-4216501
info@sleuteldienstzwolle.nl
www.sleuteldienstzwolle.nl
LockForce BV
Kromme Spieringweg 569C
2141 AL Vijfhuizen
Tel: 023-8200224
Mob: 06-21942550
info@lockforce.nl
www.lockforce.nl
Van Rossum Beveiligingen BV
Thomas a Kempisstraat 29
8021 BH Zwolle
Tel: 038-4535725
vanrossum@beveiligen.nl
www.beveiligen.nl
Safe & Secure van der Meer
Binnenweg 73
2101 JD  Heemstede
Tel: 023-5280490
info@safesecure.nl
www.safesecure.nl
Wels Security Solutions
Helena Kuipers-Rietberghof 84
1106 WE Amsterdam
Tel: 020-2602442
bw@lock-experts.com
www.intact-noodopening.nl
Slotenservice Den Helder
Bloemstraat 58
1782 LG  Den Helder
Tel: 0223-614099
info@slotenservicedenhelder.nl
www.slotenservicedenhelder.nl
Beveiligings Techniek Dordrecht BV
Merwedestraat 257-261
3313 GT  Dordrecht
Tel: 078-6148148
info@btdbeveiliging.nl
www.btdbeveiliging.nl
A-Slotenservice
Mollerusweg 38
2031 BZ  Haarlem
Tel: 023-5382481
info@a-slotenservice.nl
www.a-slotenservice.nl
De Slotenwacht
Tweede Keucheniusstraat 13
1051 VP Amsterdam
Tel: 020-3635777
info@deslotenwacht.nl
www.amsterdamslotenmaker.com

–jeroen

Posted in LifeHacker, Power User | Leave a Comment »

The user and the not so standard OSI 7 layer stack of compromises: xkcd Stack

Posted by jpluimers on 2021/02/26

Doing full stack development and operations requires one to think about compromises too. Randall Munroe did just that and created an OSI 7 layer like [WayBack] xkcd: Stack episode 2166:

Title text: Gotta feel kind of bad for nation-state hackers who spend years implanting and cultivating some hardware exploit, only to discover the entire target database is already exposed to anyone with a web browser.

And of course there is also a [WayBack] ExplainXKCD 2166

–jeroen

Posted in Development, DevOps, Software Development | Leave a Comment »

Markdeep as an extension to markdown

Posted by jpluimers on 2021/02/25

For my link archive: Markdeep

Via:

 

Related:

–jeroen

Posted in Development, Lightweight markup language, MarkDown, Software Development | Leave a Comment »

Postfix TLS Support

Posted by jpluimers on 2021/02/25

For my link archive:

–jeroen

Posted in *nix, *nix-tools, Communications Development, Development, Internet protocol suite, postfix, Power User, SMTP | Leave a Comment »

Fun with Delphi RTTI – Dump a TRttiType | The Road to Delphi

Posted by jpluimers on 2021/02/25

For my link archive a non-recursive DumpTypeDefinition method:

Here ‘s a sample code of how you can dump the declaration of a TRttiType using the Rtti. Supports classes, records and interfaces. Delphi Use in this way OutPut the output is this the output …

Source: [WayBack] Fun with Delphi RTTI – Dump a TRttiType | The Road to Delphi

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

NanoPi NEO2 1GB Metal Complete Kit, NP-NEO2-1G-STK – Antratek Electronics

Posted by jpluimers on 2021/02/24

Still an interesting device: [WayBack] NanoPi NEO2 1GB Metal Complete Kit, NP-NEO2-1G-STK – Antratek Electronics:

The NEO2 Metal Complete Kit includes:

  • NanoPi NEO2 1GB
  • NanoHat OLED
  • Aluminum housing with 3 brass buttons
  • Paste and pads
  • MicroUSB cable
  • 8GB MicroSD Card with pre-installed FriendlyCore Ubuntu
  • Screws and screw driver
  • NanoPi NEO2 quick start guide

The NanoPi NEO2 LTS (Long Term Support) is a super tiny ARM board made by FriendlyElec and uses Allwinner’s 64-bit H5 quad-core SoC (ARM Cortex-A53). It has internal hexa-core Mali450 GPU and 512MB DDR3 RAM.

The NanoPi NEO2 has Gigabit Ethernet and one USB host port. These features make it especially suitable for applications that require high data throughput, high-speed data transmission and high performance.

 

–jeroen

Posted in Development, Hardware Development | Leave a Comment »

I still print (relevant parts of) code. Have been for a long time. Will keep doing it.

Posted by jpluimers on 2021/02/24

In a response to [WayBack] Iris Classon on Twitter: “I’m curious, how many of you guys and gals have printed out code on paper to read later? Doing it during earlier years also counts 🤓”, I started the long read below starting with [WayBack] Jeroen Pluimers on Twitter: “Still do.… “.

Basically a more in depth coverage of my 2017 post Happy 60th birthday, Fortran.

[WayBack] Thread by @jpluimers: “@IrisClasson Still do. @IrisClasson There is a story behind these 1988 tractor feed print outs, which follows shortly. I should put dinosaur […]”

Still do.

There is a story behind these 1988 tractor feed print outs, which follows shortly.

I should put dinosaur or old-fart on my job description.

CC @isotopp

The story has to do with this.
A “translation” of [WayBack] Programming Fortran 77: A Structured Approach (ISBN-10: 0835956717) but I wish I had had the original back then, as in fact it was a knock off, mostly covering FORTRAN IV and 66.

Sidestory: these books were from the same era.

Machine learning and AI modern?

They are about as modern as AWK. Both still relevant though.

AWK is indispensable on many *n*x related systems, especially the low powered one. The book is still the ultimate source on it; see [WayBack] stackoverflow.com/a/703174/29290

text processing – Is there still any reason to learn AWK? – Stack Overflow

If you quickly learn the basics of awk, you can indeed do amazing things on the command line.

But the real reason to learn awk is to have an excuse to read the superb book The AWK Programming Language by its authors Aho, Kernighan, and Weinberger. You would think, from the name, that it simply teaches you awk. Actually, that is just the beginning. Launching into the vast array of problems that can be tackled once one is using a concise scripting language that makes string manipulation easy — and awk was one of the first — it proceeds to teach the reader how to implement a database, a parser, an interpreter, and (if memory serves me) a compiler for a small project-specific computer language! If only they had also programmed an example operating system using awk, the book would have been a fairly complete survey introduction to computer science!

Famously clear and concise, like the original C Language book, it also is a wonderful example of friendly technical writing done right. Even the index is a piece of craftsmanship.

Awk? If you know it, you’ll use it at the command-line occasionally, but for anything larger you’ll feel trapped, unable to access the wider features of your system and the Internet that something like Python provides access to. But the book? You’ll always be glad you read it!

Back to the story. With some side-steps to (:

Here we go…

This is end 1980s. I was a student. A year later I started my own consultancy as a side-thing.

The reason is that I had a client prospect for some PC Turbo Pascal programming. So I needed to buy some hardware. Only companies could buy hardware. So I started one.

en.wikipedia.org/wiki/Turbo_Pascal

2 years later, I was selling PC network hardware to a university research group, so they could connect to the internet. At 75% of what they would pay via their regular channels. My profit was large enough to cover for that year of studying.

Back to the print-outs.

They were on tractor-feed paper en.wikipedia.org/wiki/Continuous_stationery
We had a class: computer usage for chemistry students. It was mandatory. They were teaching from a FORTRAN 77 book that was in fact more FORTRAN IV and FORTRAN 66. Found a link to it too: [WayBack] Cursus Fortran 77, R.C. Holt, J.N.P. Hume

The way you would program in that class was via PC terminals with serial terminal emulation, connected to a VAX 11/780 machine running VAX/VMS 4.7.

The connection was through a multiplexed serial over an unshielded ribbon cable some 300 yards long.
The connection was very reliable: about 90% of the characters would transmit correctly.

So I had to reset the VT52 terminal emulation over the Kermit protocol every minute or so, then wait a dozen seconds for the screen to re-draw.

At the chemistry department it was still a VAX 11/780 machine called HLERUL5, but at the computing department they had an 11/750 called RULCRI which was faster.

They also had a bunch of VT100 terminals that could do 132-columns instead of 80, with a far more reliable connection.

en.wikipedia.org/wiki/VT100

Later the chemistry department also got their own VAX 11/750, renamed the old one to HLERUL52 for the 2nd years studens to to work on, and kept the old HLERUL5 name.

The machines were networked too, so you could connect to one, then daisy-chain your logon to the others.

Long story short: later I managed to get official accounts on both chemistry department machines, and borrow an account on the computing department one. So I had accounts on HLERUL5, HLERUL52 and access to RULCRI when needed.
Later too, I found out that the room above the VAX 11/780 also had VT100 terminals (later even two VT240 terminals!). It wasn’t meant for student use though. But with some social engineering…

In the mean time, I wanted to make better use of the VAX/VMS FORTRAN compiler.

Apart from that it fully supported FORTRAN 77, it also had many more language features and had support for 132 columns instead of just 80.

Given FORTRAN had limited use of the leftmost 8 columns, having 124 usable columns instead of just 72 made a huge difference in readability.
There was no book in the library on VAX/VMS FORTRAN, but the on-line help was great: both vast and in-depth. With the bad serial documentation though, it was very hard to read on-line.

The easiest way to read things was on paper. I think the printer back then was a LA36 DecWriter II or LA120 DecWriter III

www.youtube.com/embed/T3TifjAX51I
www.youtube.com/embed/tJ1jkINFVho

www.youtube.com/embed/T3TifjAX51I

Printing one topic at a time however was cumbersome. Print jobs were not always printed in the right order, and sending like a 100 print commands that all were slightly different was hard too.
Luckily I found out two things:
  1. you could dump the output of a FORTRAN HELP page to a file
  2. you could recursively generate all FORTRAN HELP, then redirect that to a file
The recursion was great, as it would output everything in an orderly fashion. What was lacking though is a good table of contents. More on that in a bit.
So I decided to send that file to the printer. Of course I knew that would take something like an hour, so I printed it during lunch time.
I was back from lunch early to monitor the printing progress (VAX/VMS had queues for everything, and you could monitor the ones or the parts of ones you had access to!).

The printer was right next to the VAX 11/780 and both of them were very noisy. The climate control was even noisier, which meant you wanted to avoid that room whenever possible.

So shortly after my job was ready, I wanted to pick it up and make the 300 meter walk twice.

Right at that moment, the student assistent walked in with a red face, madly screaming “who the hell printed this one inch stack of FORTRAN help”.
I responded that I did. At first she (this was a time when we had a way better balanced female/male ratio in STEM) would not even want to give my output, refusing to believe I would read it.
She also would not believe that you cour recursively send the help to a file, then print it. But the stack of paper demonstrated otherwise.
I explained that I was going to read the whole stack. It took a long weekend, as after reading, I manually made the hand written table of contents on the front.
In addition, I colour marked the sides of the paper matching the entries in the table of contents.

Now I could index into the right topics very quickly.

She was amazed I did all that in just a weekend. Apparently, that’s how my brain copes with information: need something, read something, read something, use something.

Later she actually made use of that stack of paper, as it was a great way for other people too to figure out some things faster than doing it on-line.
Back to my side-business: that’s the reason for the PASCAL stack of paper. It’s the output of the VAX/VMS help for the PASCAL compiler. It was great and helped me learn a lot on the language.

That print job took far less time: it was printed from RULCRI to the printer at the computing department. Their printer was not a dot-matrix one, line printer. It was orders of magnitude faster.

3 years later, I started doing more and more work with Turbo Pacscal and made the business my full time work.

Only a decade later, I found out why I had deverted less and less energy into my studies and more into work.

Two reasons: computers are way easier to cope with than people, and a theoretical university was totally the wrong kind of environment for my learning mode: I am an auto-didactic person. I need to do things in order to learn.
By now I have slowly learned way and way more about people. Coping with them is still tough, taking a lot of energy. But by now it is also a lot of fun. Though doing both at the same time is still very very hard for me.

Finally back to the STRUCT print job:

That was actually the FORTRAN program I developed for the assignment.

You could choose from multiple problems to solve during the assignment.

As one of the few students, I managed to finish it in-time.

I was the only one that took this particular problem.

The essence is that you got a few tables with data:

  • atom numbers, atom abbreviation and atom covalence (the number of other atoms they can bond with)
  • bond pairs with abbreviations and minimum/maximum distance
  • atom locations (abbreviation plus X/Y/Z coordinate)
The goal was to find which atoms were connected, and describe any cycles.

Only after reading the tables, then trying to solve the problem, I found out a recursive solution was needed to solve it.

Boy was I surprised that FORTRAN did not support recursion.

In the end, I implemented my own recursion with stacks citing a Dire Straits song with “and when you finally reappear, at the place where you came in…”.

A long story to explain I started printing on things to read very early on (:

/end

–jeroen

Read the rest of this entry »

Posted in Algorithms, Development, Fortran, Power User, Printers, Software Development | Leave a Comment »

Like Circuit City and Radio Shack, Fry’s Electronics closed down. We all saw it coming, but: damn.

Posted by jpluimers on 2021/02/24

https://twitter.com/pulcrano/status/1364483921509978112

https://twitter.com/geekgalgroks/status/1364579109762985985

https://twitter.com/SwiftOnSecurit1/status/1364458241997086720

https://twitter.com/akashkumarfilm/status/1364445888622387202

https://twitter.com/tipadaknife/status/1364538040681566209

Posted in Uncategorized | Leave a Comment »

Delphi compile time assertions

Posted by jpluimers on 2021/02/24

My post on Delphi intrinsic functions that evaluate to consts as a step up to Delphi compile time assertions.

This is a corner case of Delphi language use, which can come in very handy when your code is changed in the future, and you want to be prepared to ensure that some changes do not violate some predefined boundaries.

Hopefully a future post will elaborate a bit more on actual usage, but for now, lets first show some examples, then some other languages that have a richer set of compile time assertions.

My original goal was to see if I could come up with a mechanism that allowed for better validation of generic types because Delphi generic constraints – still – are quite limited: Delphi Constraints in Generics – RAD Studio XE documentation wiki, so limiting or verifying the aspects of the concrete type often cannot be done by constraints.

C# had a similar limitation for constraining to enum, which finally got added some 13 years after adding generics, in 2018: [WayBack] Unmanaged, delegate and enum type constraints – C# 7.3 in Rider and ReSharper – .NET Tools Blog.NET Tools Blog.

Let’s start simple:

const
  // forbidden const values to check compile time assert:
  A = 0;
  B = 1;
  C = -1;
  // The below expressions all each generate a "[dcc32 Error] E2098 Division by zero" (so multiple errors in one compile)
  // Asserting at compile time using boolean expressions:
  BooleanAssertAIsNotZero =  1 div Ord(A <> 0);
  BooleanAssertBIsNotOne = 1 div Ord(B <> 1);
  // Asserting at compile time using numeric expressions:
  AssertAIsNotZero = 1 div A;
  AssertBIsNotOne =  1 div (B - 1);
  AssertBIsNotAbsOne =  1 div (Abs(B) - 1);
  AssertCIsNotAbsOne =  1 div (Abs(C) - 1);

This is all centered around generating a compile time error "[dcc32 Error] E2098 Division by zero", of which multiple can occur in one compile go (after compilation, the cursor focus will be at the first error) and which has been in the language for a very long time [WayBack] E2098: Division by zero.

The conversion of Boolean to Integer is done using Ord, a very powerful compile time intrinsic that evaluates to a constant.

You can use this for other intrinsics as well, for example:

type
  TDigits = 0..9;

const
  DigitsAreInteger = GetTypeKind(TDigits) = tkInteger;
  DigitsAreIntegerIsTrue = 1 div Ord(DigitsAreInteger);
  DigitsAreEnumeration = GetTypeKind(TDigits) = tkEnumeration; // compiles fine
  DigitsAreEnumerationIsTrue = 1 div Ord(DigitsAreEnumeration); // [dcc32 Error] E2098 Division by zero

The above learns that integer subranges are not enumerations, but stay integers.

You can now extend this to check longer boolean expressions, for instance to check if a record size matches certain criteria. For this we create records having zero to four bytes in size (yes, you can have empty record in Delphi, it in fact the only data structure that can be zero bytes in length, though the documentation [WayBack] Structured Types: record types does not state this is in fact possible ), then validate the sizes:

type
  TRecord0 = record
  end;

  TRecord1 = packed record
    FByte0: Byte;
  end;

  TRecord2 = packed record
    FByte0: Byte;
    FByte1: Byte;
  end;

  TRecord3 = packed record
    FByte0: Byte;
    FByte1: Byte;
    FByte2: Byte;
  end;

  TRecord4 = packed record
    FByte0: Byte;
    FByte1: Byte;
    FByte2: Byte;
    FByte3: Byte;
  end;

const
  AssertTRecord0SizeOf0 = 1 div Ord(SizeOf(TRecord0) = 0); // When expression is false: [dcc32 Error] E2098 Division by zero
  AssertTRecord0SizeOf1 = 1 div Ord(SizeOf(TRecord1) = 1); // When expression is false: [dcc32 Error] E2098 Division by zero
  AssertTRecord0SizeOf2 = 1 div Ord(SizeOf(TRecord2) = 2); // When expression is false: [dcc32 Error] E2098 Division by zero
  AssertTRecord0SizeOf3 = 1 div Ord(SizeOf(TRecord3) = 3); // When expression is false: [dcc32 Error] E2098 Division by zero
  AssertTRecord0SizeOf4 = 1 div Ord(SizeOf(TRecord4) = 4); // When expression is false: [dcc32 Error] E2098 Division by zero
  AssertTRecord0SizeOfMultipleOf4 = 1 div Ord(SizeOf(TRecord0) mod 4 = 0); // When expression is false: [dcc32 Error] E2098 Division by zero
  AssertTRecord4SizeOfMultipleOf4 = 1 div Ord(SizeOf(TRecord4) mod 4 = 0); // When expression is false: [dcc32 Error] E2098 Division by zero
  AssertTRecord0SizeOfMultipleOf4AndGreaterThan0 = 1 div Ord((SizeOf(TRecord0) mod 4 = 0) and (SizeOf(TRecord0) > 0)); // When expression is false: [dcc32 Error] E2098 Division by zero
  AssertTRecord4SizeOfMultipleOf4AndGreaterThan0 = 1 div Ord((SizeOf(TRecord4) mod 4 = 0) and (SizeOf(TRecord4) > 0)); // When expression is false: [dcc32 Error] E2098 Division by zero

That’s how far I got in my first experiments using this mechanism. Hopefully it gave you some inspiration too, so I welcome any usages you made with it.

Inline use of intrinsics can lead to no generated code at all

Since Delphi has no macro language, you cannot create your own intrinsic functions that evaluate to const. You could use a pre-processor though, as described in [WayBack] How to write Delphi compile-time functions – Stack Overflow.

The answer by Johan there however mentions clever use of in-line functions that do not generate any code at all (so effectively evaluate to a const). More on that in a future post.

Compile time assertions in other languages

Many languages support a form of [WayBack] Compile-time calculation – Rosetta Code. If such a language can errors out on compiling such a calculation, then you can have compile time assertions.

Compile time assertions are very much used in C and C++, where they are often called static assertions. Often they depend on macros, but C11 (C standard revision 11) has it built-in.

Since I also do quite a bit of .NET: [WayBack] Can C# Provide a static_assert? – Stack Overflow

Some links on how they work in C and C++, and what you can do with them:

–jeroen

Posted in .NET, C, C#, C++, Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »