Archive for the ‘C++’ Category
Posted by jpluimers on 2013/03/07
A while ago I was involved in a C header file translation for the header files of the IBM WebSphere MQ family of products, and the table helped a lot for the base types:
Delphi to C++ types mapping – RAD Studio.
A few C things missing there:
These articles helped resolving the missing bits:
Now we can do SOA between System i (a.k.a. iSeries, aka AS/400) from Windows 7.
–jeroen
PS: Later I found someone else also did a lot of work on this and published http://www.milosev.com/Download/WebSphere/WebSphereD2009.rar [WayBack] (thanks Murat Mutlu for pointing me at that) with a very thin note at http://www.milosev.com/32-mq/mq/171-delphi-2009.html [WayBack]
Posted in C++, C++ Builder, Delphi, Delphi 2006, Delphi XE2, Development, MQ Message Queueing/Queuing, Software Development, WebSphere MQ | Leave a Comment »
Posted by jpluimers on 2013/02/27
The continuation of the trip down memory lane…
Few people know the name Peter Sollich, as he always chose not to be a public figure (for instance, he is absent on the Outstanding Technical Achievement video).
Peter has been very important for both the Delphi and the .NET worlds: he was the original author of the 32-bit product that became the Delphi x86 compiler.
A few interesting links came up when using his name in some Google searches.
–jeroen
Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET CF, C++, C++ Builder, Delphi 1, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Development, Software Development | 2 Comments »
Posted by jpluimers on 2013/01/26
Back in the days I started programming, Micro Cornucopia was a wonderful magazine, so I’m glad that BitSavers scanned a few more issues and put them online today, a week after some great PDF scans: Turbo Assembler/Debugger (1993/1994), Borland C++/Object Windows Library (1993):
They covered a lot of languages (x86 and 68k assembly, C, C++, Turbo Pascal and many more), and very interesting hardware designs.
–jeroen
via: Index of /pdf/microCornucopia.
Posted in Assembly Language, BitSavers.org, C, C++, Delphi, Development, History, Pascal, Software Development, Turbo Assembler, Turbo Pascal, x86 | Tagged: computer, software, technology, wonderful magazine | 2 Comments »
Posted by jpluimers on 2013/01/17
The PDF Archive at bitsavers.org has recently put online these raster image PDF scans from Turbo Assembler/Debugger (1993/1994) and Borland C++/Object Windows Library (1993)
Remnants of the past, usefull for RAD Studio, Delphi and C++ Builder developers wanting to know a bit of history (: Read the rest of this entry »
Posted in Assembly Language, BitSavers.org, Borland C++, C, C++, Delphi, Development, History, Pascal, Software Development, Turbo Assembler, Turbo Pascal, x86 | Tagged: assembler version, borland C++, computer, object windows library, programmers guide, software, technology, turbo assembler | 2 Comments »
Posted by jpluimers on 2012/12/06
Thanks Nick Craver for answering this on StackOverflow.
Array initializers can be specified in field declarations (§17.4), local variable declarations (§15.5.1), and
array creation expressions (§14.5.10.2).
The array initializer can end in a comma, which makes some things way easier (boy, I wish I had this in other programming languages).
From Nick’s answer:
It has no special meaning, just the way the compiler works, it’s mainly for this reason:
[FlagsAttribute]
public enum DependencyPropertyOptions : byte
{
Default = 1,
ReadOnly = 2,
Optional = 4,
DelegateProperty = 32,
Metadata = 8,
NonSerialized = 16,
//EnumPropertyIWantToCommentOutEasily = 32
}
[/language]By comment request: This info comes straight out of the ECMA C# Specification (Page 363/Section 19.7)
“Like Standard C++, C# allows a trailing comma at the end of an array-initializer. This syntax provides flexibility in adding or deleting members from such a list, and simplifies machine generation of such lists.”
–jeroen
via c# – .NET Enumeration allows comma in the last field – Stack Overflow.
Posted in .NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Delphi, Development, Java, JavaScript/ECMAScript, PHP, Software Development, VB.NET | 5 Comments »
Posted by jpluimers on 2012/11/20
A while ago I had a “duh” moment while calling a method that had many overloads, and one of the overloads was using int, not the char I’d expect.
The result was that a default value for that char was used, and my parameter was interpreted as a (very small) buffer size. I only found out something went wrong when writing unit tests around my code.
The culprit is this C# char feature (other implicit type conversions nicely summarized by Muhammad Javed):
A char can be implicitly converted to ushort, int, uint, long, ulong, float, double, or decimal. However, there are no implicit conversions from other types to the char type.
Switching between various development environments, I totally forgot this is the case in languages based on C and Java ancestry. But not in VB and Delphi ancestry (C/C++ do numeric promotions of char to int and Java widens 2-byte char to 4-byte int; Delphi and VB.net don’t).
I’m not the only one who was confused, so Eric Lippert wrote a nice blog post on it in 2009: Why does char convert implicitly to ushort but not vice versa? – Fabulous Adventures In Coding – Site Home – MSDN Blogs.
Basically, it is the C ancestry: a char is an integral type always known to contain an integer value representing a Unicode character. The opposite is not true: an integer type is not always representing a Unicode character.
Lesson learned: if you have a large number of overloads (either writing them or using them) watch for mixing char and int parameters.
Note that overload resolution can be diffucult enough (C# 3 had breaking changes and C# 4 had breaking changes too, and those are only for C#), so don’t make it more difficult than it should be (:
Below a few examples in C# and VB and their IL disassemblies to illustrate their differnces based on asterisk (*) and space ( ) that also show that not all implicits are created equal: Decimal is done at run-time, the rest at compile time.
Note that the order of the methods is alphabetic, but the calls are in order of the type and size of the numeric types (integral types, then floating point types, then decimal).
A few interesting observations:
- The C# compiler implicitly converts char with all calls except for decimal, where an implicit conversion at run time is used:
L_004c: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::op_Implicit(char)
L_0051: call void CharIntCompatibilityCSharp.Program::writeLineDecimal(valuetype [mscorlib]System.Decimal)
- Same for implicit conversion of byte to the other types, though here the C# and VB.NET compilers generate slightly different code for run-time conversion.
C# uses an implicit conversion:
L_00af: ldloc.1
L_00b0: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::op_Implicit(uint8)
L_00b5: call void CharIntCompatibilityCSharp.Program::writeLineDecimal(valuetype [mscorlib]System.Decimal)
VB.NET calls a constructor:
L_006e: ldloc.1
L_006f: newobj instance void [mscorlib]System.Decimal::.ctor(int32)
L_0075: call void CharIntCompatibilityVB.Program::writeLineDecimal(valuetype [mscorlib]System.Decimal)
Here is the example code: Read the rest of this entry »
Posted in .NET, Agile, Algorithms, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Delphi, Development, Encoding, Floating point handling, Java, Software Development, Unicode, Unit Testing, VB.NET | 1 Comment »
Posted by jpluimers on 2012/08/30
Too often I see quesions like the one below on software that people distribute:
The Program can’t start becuase MSVCR100.dll is missing from your computer. Try reinstalling the program to fix this problem.
I am getting follwing error when i am trying to open Computer management in windows 7,the error is as follows ,
The Program can’t start becuase MSVCR100.dll is missing from your computer. Try reinstalling the program to fix this problem.
Where can i found this dll file, and help me to download and install.
The reason is that many programmers and companies still fail to ship the correct Visual C++ run-time.
Even for a one-off, you should need to get your installation set right. And writing stuff in a version of Visual C++ almost always means you need to ship the run-time for that particular version of Visual C++ with your application (though sometimes you can get away by putting the DLLs in the directory of your application, this is not recommended, as that way you won’t receive security updates).
User Marilyn O was so kind to sum up most of the download locations (I did a bit of post-editing, added all the non-“FamilyID” links, all naming differences are from the MS site):
I would install the Microsoft Visual C++ Redistributable dll that is needed for projects built with Visual Studio 2010.
Download the files below depending on your operating system version. […] Check in Programs and Features, do you show that you have installed Microsoft Visual C++ … Redistributable? If not, download from the links here.
- 2005: msvcr80.dll
- 2008: msvcr90.dll
- 2008 SP1: msvcr90.dll
- 2010: msvcr100.dll
- 2010 SP1: msvcr100.dll
- 2012: msvcr110.dll
–jeroen
via: The Program can’t start becuase MSVCR100.dll is missing from your – Microsoft Answers.
Posted in C++, Development, Power User, Software Development, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools, Windows, Windows 7, Windows 8, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP | 3 Comments »
Posted by jpluimers on 2012/08/15
A few weeks ago, Bill Karwin did a must watch webinar on the prevention SQL Injection titled “SQL Injection Myths and Fallacies“.
Bill Karwin (twitter, new blog, old blog, Amazon) is famous for much work in the SQL database community, including InterBase/Firebird, mySQL, Oracle and many more.
He also:
Anyway, his webinar is awesome. Be sure to get the slides, watch the replay, and read the questions follow up.
Watching it you’ll get a better understanding of defending against SQL injection.
A few very valuable points he made: Read the rest of this entry »
Posted in .NET, .NET 3.5, .NET 4.5, .NET ORM, ASP.NET, Batch-Files, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Cloud Development, COBOL, CommandLine, Database Development, Delphi, Delphi for PHP, Delphi x64, Delphi XE2, Development, EF Entity Framework, F#, Firebird, FireMonkey, History, InterBase, iSeries, Java, JavaScript/ECMAScript, Jet OLE DB, LINQ, LLBLGen, MEF, Microsoft Surface, Mobile Development, PHP, PowerShell, Prism, Scripting, SharePoint, SilverLight, Software Development, SQL, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7, VB.NET, VBS, Visual Studio 11, Visual Studio 2002, Visual Studio 2003, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools, Web Development, Windows Azure, WinForms, WPF, XAML, xCode/Mac/iPad/iPhone/iOS/cocoa | 1 Comment »
Posted by jpluimers on 2012/07/04
Some nostalgia (:
In the mid 80s, when programming in UCSD Pascal and Turbo Pascal, I learned that Pascal has (. and .) digraphs that translate into [ and ], similar to the (* and *) digraphs that translate to { and }.
In fact I thought the English word was bigraph (as bi- is a prefix for twice, just like tri- is a prefix for thirce).
The digraphs are lexical alternatives (Pascal ISO standard 7185:1990 paragraph 6.1.9 or Extended Pascal ISO standard 10260:1990 paragraph 6.1.11). There is even one more: the @ at-sign is a lexical alternative for the ^ caret.
Back then (I was in my teens, there was no internet yet and school library had nothing on programming) I thought these were because keyboards like those of the Apple ][ plus couldn’t emit [ and ], but I was wrong: it was in fact the Hollerith Card Code that could not represent these characters.
That limitation was because of the first Pascal implementation was done on a CDC 6000 series that used punched card readers/writers. You could not punch arbitrary numbers of holes on each row (lace cards lacked structural strength) limiting the character codes you can represent.
They still work in the Delphi compiler for arrays and for comments (I just learned that various Pascal implementations use different rules of mixing digraph and normal comments (some even allow nesting)).
While I taught myself C and C++ just as I taught myself Pascal, somehow I never learned that they use lexical alternatives too. It was only recently that they do, both as trigraphs and as of C99 also as digraphs and that there is even a trigraph tool as part of the C++ personality of RAD Studio 2007.
–jeroen
Posted in Apple, Apple ][, C++, Delphi, Development, History, Keyboards and Keyboard Shortcuts, Power User, Software Development | 1 Comment »