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,861 other subscribers

Archive for the ‘Turbo Pascal’ Category

Delphi `with` post and discussion revisited (via: wiert.me and LinkedIn)

Posted by jpluimers on 2014/06/11

A bit more than a year ago, I wrote about Delphi: you should avoid the with statement as it makes your code less future proof. That caused some nice comments on the blog, and some more on LinkedIn where Paul Foster mentioned it in a thread ‘Jeroen Pluimers makes a case against “with” statements.‘ Both interesting reads, especially the reasons that people use or avoid with, or keep its use in balance. There is one set of comments I want to emphasize: refactoring multiple with statements into a one function and a call per former with. Read the rest of this entry »

Posted in Borland Pascal, Delphi, Delphi 1, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, Pascal, Software Development, Turbo Pascal, With statement | 19 Comments »

April 2014 Project of the Month, Free Pascal | SourceForge Community Blog

Posted by jpluimers on 2014/04/16

Thanks Olivier SCHWAB for pointing me to this nice interview with Florian Klämpfl on SourceForge about April 2014 Project of the Month, Free Pascal | SourceForge Community Blog.

Two things I didn’t know yet:

  • FreePascal started in the Turbo Pascal era (the first version was before Delphi 1.0 got released) as a 32-bit compiler project.
  • FreePascal 3.0 will support jvm output (like Oxygene does).

Besides Florian, there are quite a few more people on the FreePascal team. I met most of them at last years PasCon: really nice guys.

–jeroen

Posted in Delphi, Development, FreePascal, Object Pascal, Oxygene, Pascal, Software Development, Turbo Pascal | Tagged: , , , | 5 Comments »

The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs

Posted by jpluimers on 2014/04/09

Interesting read:

The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs.

In other words: any language that merges null behaviour in the underlying storage will have a problem somwehere.

So if you want to have true nullable types, your null flag should be stored outside the underlying storage.

The .NET framework 2 and up, most database management systems and many other environment support that.

But most languages don’t support it for pointer types. So there will be portions of address spaces either inaccessible, or only accessible when skipping the null pointer checks.

Note that the thread above contains some very interesting bits, for instance this one:

Matt 28 Mar 2013 5:58 PM #

@MarkY “Dereferencing null is undefined?  Cool!  I thought it was guaranteed to crash, just like a false assertion or something.  So crashing is the OS guarantee, not the language guarantee apparently.”

Nope. It’s not an OS guarantee either. The OS won’t ever normally allocate memory at address zero, but there’s nothing to stop you telling it to. Try doing “VirtualAlloc(1, 4096, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)” on your pre-Windows8 machine.

In fact, this is the reason why null-dereferences in kernel mode are often exploitable as elevation of privilege attacks. The null-page is mappable and within the user-addressable region of memory, so if the kernel dereferences a null pointer, it reads attacker controllable data.

And btw, this is the reason why on Linux and Windows8+ you can’t map the null-page.

–jeroen

via: The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs.

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Borland C++, Borland Pascal, C, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, C++ Builder, Database Development, Delphi, Development, Pascal, Quick Pascal, Software Development, Turbo Pascal, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 8.0, VB.NET 9.0 | Leave a Comment »

Turbo Pascal: My 1996 answer to Q: How can I reverse a TP .EXE or .TPU back into source code?

Posted by jpluimers on 2014/03/20

Wow, did I really wrote that 18 years ago?

Yes I did, and I was quoted in the (back then famous) FAQPAS3.TXT from (now Professor Emeritus) Timo Salmi: The third set of frequently (and not so frequently) asked Turbo Pascal questions with Timo’s answers. The items are in no particular order.

From ts@uwasa.fi Fri Nov 8 00:00:56 1996
Subject: Decompiling a TP .EXE

56.
Q: How can I reverse a TP .EXE or .TPU back into source code?

A: This is simply asking too much. You cannot decompile a TPprogram in a manner that would give you back the original source.This method of reverse engineering is not on in actual practice.

Quoting Jeroen Pluimers jeroenp@dragons.nest.nl

“During thecompilation, important information gets lost about variables,types, identifiers etc. Writing a Pascal Decompiler is impossible.The best you can achieve is a disassembler that can help yourecognize some Pascal statements.”

Since then I learned that compilers emit highly predictable CPU code that – with the right, and sometimes complex, algorithms – can be reconstructed into language structures.

Of course you are missing the identifiers and comments, but you can some remarkable info, especially with well structured code.

Two more links about this:

–jeroen

via: FAQPAS3.TXT.

Posted in Delphi, Development, Pascal, Software Development, Turbo Pascal | 2 Comments »

WITH IS EVIL! (via: Paul Foster – Google+)

Posted by jpluimers on 2014/03/13

Yet another example of somehow who got bitten hard by using the with statement (I decided to give with its own category on my blog).

This time it got shared by Paul Foster on G+ and comes down to this:

Even in unsuspiciously looking code, the wit statement can bite you, especially if you need to do refactoring and (because of that) introduce two names in the same scope.

Or in Paul‘s words:

Whilst upgrading the code to remove the Containers unit (its not supported on NextGen platforms, so I have to make things work with Generics.Collections instead, (bye bye D7 support for this code) and refactor a couple stupidities in my original design (they always creep in, don’t they) I ended up with two class members of the same name.  The with block then looked OK but I was in fact not access the member I thought I was. 

–jeroen

via: Paul Foster – Google+ – WITH IS EVIL! God damn it, I know it makes code easier to….

Posted in Borland Pascal, Delphi, Delphi 1, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Pascal, Software Development, Turbo Pascal, With statement | 18 Comments »

History: run HD image with Borland’s Turbo Pascal 5.5/6.0/7.0 and Microsoft’s QuickPascal 1.0 in VMware Fusion

Posted by jpluimers on 2014/03/12

Edit 20250102: added various “[Wayback/Archive]” archival links, VMware information, amended TUWA location, and added alternative csboot.zip download location on the Internet Archive (the Wayback Machine download is broken and the original gone)

A really long time ago, I posted in [Wayback/Archive] history – What features contributed to the evolution of Pascal? – Programmers indicating there was a [Wayback/Archive] Hard Disk Image of MS-DOS 6.22 with Pascal for Computer Studies. In fact, that is an IMG file of a DOS hard disk. And this posts shows how to use it with VMware Fusion on Mac OS X. The is a hard disk image contains:

  • A full version of MS-DOS 6.22 (MSDN Original)
  • Borland Turbo Pascal 7.0 (main)
  • Borland Turbo Pascal 6.0
  • Borland Turbo Pascal 5.5
  • Microsoft QuickPascal 1.0

Edit 20250102: does not work under VMware Fusion when you run Apple Silicon. Not figured out a performant alternative yet. Will try figuring out later.

DOS on a Mac

Read the rest of this entry »

Posted in Borland Pascal, Development, Fusion, Pascal, Power User, Quick Pascal, Software Development, Turbo Pascal, Virtualization, VMware, VMware Workstation | 1 Comment »

Link clearance: history of Pascal / Object Pascal / Delphi Language / FreePacal / …

Posted by jpluimers on 2014/02/25

This post lists a lot of links related to the history of Pascal / Object Pascal / Delphi Language / FreePascal / etc.

No mentioning of Pascal should start without Niklaus Wirth. At the time of writing he is still alive, hopefully he still is a the time of publication.

Link clearance.

Categories on my blog:

–jeroen

Posted in Apple Pascal, BitSavers.org, Borland Pascal, DEC Pascal, Delphi, Development, FreePascal, History, Object Pascal, Pascal, Software Development, Think Pascal, Turbo Pascal, UCSD Pascal | 7 Comments »

Delphi: `with` dos and dont’s (more of the latter though).

Posted by jpluimers on 2014/02/18

About a year ago, I wrote about Delphi: you should avoid the with statement as it makes your code less future proof. Then I already tweeted I would follow up. Time to do it now (:

Besides my first post, these links inspired me most:

Posts about the with statement usually cause a stir: people either like or dislike it with passion.

Starting with some history and examples, this posts lists a few DOs and DON’Ts when using the with statement, shows advantages and drawbacks, and shows you tools to eliminate with statements. Read the rest of this entry »

Posted in Borland Pascal, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, Pascal, Software Development, Turbo Pascal, With statement | 9 Comments »

Do not share DCU files between projects (via: delphi – Compiler Directive IF and IFEND – Stack Overflow)

Posted by jpluimers on 2014/02/13

Summary: Always try to avoid sharing .DCU files between projects.

I see a lot of projects at clients that do not have their individual DCU directories set (therefore having the DCU files in the same directory as the PAS files causing shared units to share the DCU files), or share DCU files among different projects.

Both are a very bad idea, as the compiler does not always understand when the DCU file does not match the combination of PAS file and compiler options.

The result is the occasional use of the DCU file in stead of the PAS file causing wrong code to be used, or wrong debugger information to be included.

Danny Thorpe phrased it on Stack Overflow: Read the rest of this entry »

Posted in Borland Pascal, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, FreePascal, Lazarus, Pascal, Turbo Pascal | 9 Comments »

Happy 30th birthday Mac!

Posted by jpluimers on 2014/01/24

Being away from a computer sometimes means you forget about events.

So before I forget: happy 30th birthday Mac!

For me, real programming started 31 years ago on an Apple II at high school, soon followed by a II+ and a //e. At first, I was programming in both Integer Basic and AppleSoft Basic, then with Apple Pascal (which was based on UCSD Pascal, but way too slow), and finally with Turbo Pascal 1.0 (after they installed a Microsoft Z-80 softcard in a few of the machines which allowed it to run CP/M).

Back then me, nor my parents could afford a computer like a Mac, but I was lucky enough to keep on people at the “close by” (30 minutes by bicycle) University to use one and program in hyper card and various Pascal dialects (and later Delphi).

Now I own a few Macs (most more portable than the //c) bought a //e and //c last summer and collecting some extension cards to make life easier.

Just look at the B&N magazine rack how popular the Apple stuff is today:

image

So again: happy 30th birthday Mac!

Without you, I wouldn’t be a software developer.

–jeroen

via: Apple bracht eerste Mac-computer 30 jaar geleden uit – Computer – Nieuws – Tweakers.

Posted in //e, Apple, Apple Pascal, Delphi, Development, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, Object Pascal, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Pascal, Power User, Software Development, Think Pascal, Turbo Pascal, UCSD Pascal | 1 Comment »