Archive for the ‘C++’ Category
Posted by jpluimers on 2016/06/15
This is what the Delphi [WayBack] System.Classes.TThread.NameThreadForDebugging (introduced in Delphi 2010) is based on:
//
// Usage: SetThreadName (-1, "MainThread");
//
#include <windows.h>
const DWORD MS_VC_EXCEPTION=0x406D1388;
#pragma pack(push,8)
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // Must be 0x1000.
LPCSTR szName; // Pointer to name (in user addr space).
DWORD dwThreadID; // Thread ID (-1=caller thread).
DWORD dwFlags; // Reserved for future use, must be zero.
} THREADNAME_INFO;
#pragma pack(pop)
void SetThreadName( DWORD dwThreadID, char* threadName)
{
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = threadName;
info.dwThreadID = dwThreadID;
info.dwFlags = 0;
__try
{
RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info );
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
}
}
Related:
For Delphi 2009 and 2007: It is implemented in the SetThreadName method of the IdGlobal unit.
–jeroen
Posted in C++, Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/03/09
I never had the box, but someone is selling the [Wayback] 10+ kg Borland C++ 3.0 box:

Edit 2022-02-04: the above went away because of link rot, so I replaced it with an Archive.is version as it was copied at [Wayback/Archive.is] My First Windows C++ Application in Ages: Hello World in Win32 with Visual C++ 2010 – Pete Brown’s 10rem.net.
I did a bit of digging ([Wayback/Archive.is] borland c++ box – Google Search) and found [Wayback/Archive.is] Version information for older Borland/Inprise C Compilers has all the product box photos of these products:
Borland C++ 3.1 through 4.5 shipped in huge boxes, each even larger than the before it.
The box with the 1994 Borland C++ 4.5 and Database Tools supported DOS, Windows, and Win32. It had either a CD or 28 3.5″ HD diskettes.

The last version with 5.25″ diskettes was the 1991 Borland C++ 3.1: 15-5.25″ 1.2 Meg. Diskettes or 15 3.5″ 1.44MB disks.

–jeroen
Posted in Borland C++, C++, Development, Software Development | 2 Comments »
Posted by jpluimers on 2015/10/07
A long time ago, there was an interesting discussion here: I was wondering, that what is the closest value to the Zero floating point can have.
Recently I needed to do some calculations on series where getting close to zero could become a problem.
- Math seems to have an Epsilon of 1E-12.
- Sytem.Types has Epsilon of 1E-30 and Epsilon2 of 1E-40.
- XE4+ FMX has IsEssentiallyZero and IsNotEssentiallyZero for Single values.
In practice it depends a lot on what you are doing. Sometimes absolute Epsilons are best, but at other times relative difference is much more applicable.
Then there is also a Machine Epsilon: a way to derive an Epsilon from a data type that works in all languages and platforms.
–jeroen
Posted in .NET, Algorithms, C, C#, C++, Delphi, Development, Floating point handling, Software Development | 1 Comment »
Posted by jpluimers on 2015/09/02
If ever in need to translate C/C++ headers or code to Delphi, this refernece by Rudy Velthuis – a dentist with a strong interest in programming – is the best I could find: Rudy’s Delphi Corner – Pitfalls of converting.
It is written in a pretty version agnostic way, and covers the vast majority of conversion topics.
And it has been updated over time numerous times.
–jeroen
Posted in Borland C++, C, C++, C++ Builder, Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 10 Comments »
Posted by jpluimers on 2015/06/18
Almost two years ago, I wrote “the only issues missing are #28, #30 and #31.”. As of mid May any more:
All of them are from the 5th anniversary year.
–jeroen
via 2 More Old Micro Cornucopia issues on BitSavers from 1986 « The Wiert Corner – irregular stream of stuff.
Posted in 6502 Assembly, Assembly Language, BitSavers.org, C, C++, Development, History, Pascal, Software Development, Turbo Pascal | Leave a Comment »
Posted by jpluimers on 2015/01/22
Wow: I feel like having lived under a stone for 8 years, as RosettaCode has been alive since it was founded in 2007 by Mike Mol.
The idea is that you solve a task and learn from that, or learn by seeing how others have solved tasks or draft tasks.
So in a sense it is similar to the Rosetta stone: it has different languages phrasing the same tasks.
There are already a whole bunch of languages on RosettaCode (of which a few are in the categories below), and you can even suggest or add your own languages.
When you want to solve tasks, be sure to look at the list unimplemented tasks by language that leads to automatic reports by language (for instance two of the languages I use most often: C# and Delphi).
I’m sure there are lots of programming chrestomathy sites, even beyond the ones, and it feels very similar to programming kata sites.
–jeroen
Posted in .NET, APL, Awk, bash, Batch-Files, C, C#, C++, COBOL, CommandLine, Delphi, Development, Fortran, FreePascal, Java, JavaScript/ECMAScript, Lazarus, Object Pascal, Office VBA, Pascal, Perl, PHP, PowerShell, PowerShell, Prism, Scripting, sed script, Sh Shell, Software Development, Turbo Prolog, VB.NET, VBS, VBScript, Visual Studio and tools, Web Development | Leave a Comment »
Posted by jpluimers on 2014/11/05
An interesting statement by Steve Maughan:
Looking at how many High DPI awareness or lack of is the developers Y2K of our time.
Looking at the trouble Windows and Windows applications in general have with High DPI (more in general: resolution independence). I think it rates even higher: as the EUR introduction problem of our time.
What do you think?
–jeroen
via High DPI awareness is must have feature for XE8. Not only for Delphi IDE, but….
Posted in .NET, C++, Delphi, Development, Software Development, WPF | 12 Comments »
Posted by jpluimers on 2014/08/20
Depending on how you organize locks (for instance via waiting on semaphores or mutexes or spinlocks), deadlocks can become livelocks:
Inability to make forward progress because of conflicting spinlocks is usually referred to as ‘livelock’.
Thanks to Martin James for reminding me of that and Danny Thorpe for describing different ways of locking.
Be sure to read on deadlock prevention as well.
–jeroen
via: c++ – Do deadlocks cause high CPU utilization? – Stack Overflow.
Posted in .NET, C++, Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2014/04/11
This Explorer extension is brilliant: Path Copy Copy – Home.
It works in Windows XP and up (including 7, 8 .x, 20xx Server, etc).
The Open Source is done in Visual Studio with C++.
–jeroen
Read the rest of this entry »
Posted in C++, Development, Power User, Software Development, Visual Studio 2010, Visual Studio and tools, Windows, Windows 7, Windows 8, Windows 8.1, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP | Leave a Comment »