473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Is the C++ part of VisualC++ a misnomer?

I am looking at some Visual C++ code and I am amazed at the number of
proprietary extensions to C++ that I am seeing. I even wonder if this
is the same language! I understand the need to have a graphics
library, but I don't see the rationale for tcin, tcout, tcerr,
tstring, _T, __int64, _tcscmp, _tcschr, _tcslen etc. The list could
go on and on. Does anyone know the background for all this? What was
the need to reinvent the wheel?

@@@@@ Does anyone know of a tool (e.g. perl script) that can clean up
the VisualC++ **** and convert it to ANSI C++ code? @@@@@

@@@@@ Will MSFT succeed in bulldozing everybody and getting these
proprietary extensions rolled into the proposed standard? @@@@@

Thanks,
Bhat
Nov 28 '07 #1
4 1956
kb***@kaxy.com wrote:
:: I am looking at some Visual C++ code and I am amazed at the number
:: of proprietary extensions to C++ that I am seeing. I even wonder
:: if this is the same language! I understand the need to have a
:: graphics library, but I don't see the rationale for tcin, tcout,
:: tcerr, tstring, _T, __int64, _tcscmp, _tcschr, _tcslen etc. The
:: list could go on and on. Does anyone know the background for all
:: this? What was the need to reinvent the wheel?

The C++ standard has nothing much to say about extensions, except that
names like _tcslen etc are reserved to the implementation. Supposedly
the implementation should use them for something. :-)

Most of these names are implementation specific macros, present only
if you include specific headers, like tchar.h. The idea is that you
should be able to write code that sort of works both for Windows 95/98
and Windows NT or later.

If you don't use these names, but write ISO C++ code, almost
everything works as expected. If you don't need the duality of the _t
things to try to support ancient OSs, just don't use them!

::
:: @@@@@ Does anyone know of a tool (e.g. perl script) that can clean
:: up the VisualC++ **** and convert it to ANSI C++ code? @@@@@

Not needed - just don't use what you don't like.

::
:: @@@@@ Will MSFT succeed in bulldozing everybody and getting these
:: proprietary extensions rolled into the proposed standard? @@@@@

No, but they have an entirely different standard working for them,
ECMA C++/CLI.

http://www.ecma-international.org/pu...s/Ecma-372.htm

Bo Persson
Nov 28 '07 #2
Bo Persson wrote:
kb***@kaxy.com wrote:
:: I understand the need to have a
:: graphics library, but I don't see the rationale for tcin, tcout,
:: tcerr, tstring, _T, __int64, _tcscmp, _tcschr, _tcslen etc. The
:: list could go on and on. Does anyone know the background for all
:: this? What was the need to reinvent the wheel?
With the exception of __int64, these are all related to Unicode support. If
you use them, you can write your application to use either UTF-16 or a
locale-dependent MBCS encoding based on a compile-time #define.
If you don't need the duality of the _t
things to try to support ancient OSs, just don't use them!
If you don't use them, you have to choose between bytes and wide characters
for things like fopen(), and there's no reasonable choice. On Unix you
almost certainly want bytes; on Windows you almost certainly want wide
characters. Of course, the _t functions, being Windows-specific, are even
worse. It's a terrible situation. It wouldn't be a problem if Windows
supported UTF-8 as a locale encoding, but it doesn't, apparently because
locale encodings can't have code sequences more than two bytes long.

I think the best solution would be to standardize something like the _t
functions (and while I'm dreaming, it should work by overloading and
typedefs instead of #defines). Failing that, people should use a nonstandard
but portable wrapper library. Unfortunately, most people just use byte
strings, which is a major hassle for people like me who have filenames on
their Windows systems with characters outside the locale encoding.

-- Ben
Nov 28 '07 #3
On Nov 28, 9:42 pm, Ben Rudiak-Gould <br276delet...@cam.ac.ukwrote:
Bo Persson wrote:
kb...@kaxy.com wrote:
:: I understand the need to have a
:: graphics library, but I don't see the rationale for tcin, tcout,
:: tcerr, tstring, _T, __int64, _tcscmp, _tcschr, _tcslen etc. The
:: list could go on and on. Does anyone know the background for all
:: this? What was the need to reinvent the wheel?
With the exception of __int64, these are all related to
Unicode support. If you use them, you can write your
application to use either UTF-16 or a locale-dependent MBCS
encoding based on a compile-time #define.
That is, of course, bullshit. The logic you use for UTF-16 will
have to be different than that you use for UTF-8, ISO 8859-1, or
whatever. For that matter, the logic you program will have to
be different for UTF-8 than for ISO 8859-1, even though they
will typically have the same type.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Nov 29 '07 #4

"Ben Rudiak-Gould" <br***********@cam.ac.ukwrote in message news:fi**********@gemini.csx.cam.ac.uk...
Bo Persson wrote:
>kb***@kaxy.com wrote:
:: I understand the need to have a
:: graphics library, but I don't see the rationale for tcin, tcout,
:: tcerr, tstring, _T, __int64, _tcscmp, _tcschr, _tcslen etc. The
:: list could go on and on. Does anyone know the background for all
:: this? What was the need to reinvent the wheel?

With the exception of __int64, these are all related to Unicode support. If you use them, you can write your application to use
either UTF-16 or a locale-dependent MBCS encoding based on a compile-time #define.
>If you don't need the duality of the _t things to try to support ancient OSs, just don't use them!

If you don't use them, you have to choose between bytes and wide characters for things like fopen(), and there's no reasonable
choice. On Unix you almost certainly want bytes; on Windows you almost certainly want wide characters. Of course, the _t
functions, being Windows-specific, are even worse. It's a terrible situation. It wouldn't be a problem if Windows supported UTF-8
as a locale encoding, but it doesn't, apparently because locale encodings can't have code sequences more than two bytes long.

I think the best solution would be to standardize something like the _t functions (and while I'm dreaming, it should work by
overloading and typedefs instead of #defines). Failing that, people should use a nonstandard but portable wrapper library.
Unfortunately, most people just use byte strings, which is a major hassle for people like me who have filenames on their Windows
systems with characters outside the locale encoding.

-- Ben
Thank you Ben that was interesting.

http://www.google.com/search?hl=en&q...=Google+Search

John
Nov 29 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christian | last post by:
Hi all, I have an application with a GUI in Tcl/Tk (running on AIX /Linux) and I need to make it running (porting) in Windows 2000. I would like to have some suggestion about this. What IDE...
19
by: Carlo Milanesi | last post by:
Mathematically speaking, a 'vector' is something you can add to another vector and multiply by a number. But in C++, the following code is illegal: std::vector<double> v1(3), v2(3); v1 + v2; //...
2
by: JumpinJeff | last post by:
I am about to revamp the most referenced table in my whole database and am unsure the best way to approch it. The table's primary key is also used as a part number for all the items in the table. ...
1
by: Alberto Salvati | last post by:
Hi, list! I'm a delphi develeper. Using borland c#builder trial I've create an application mda without external tools (i.e. enterprise architet, rose...). This is "ECO MODEL". Now, I don't...
6
by: Larry | last post by:
After installing VisualC# Standard, DX9 will not install the debugger. Any other users of C# Standard have similar problems? PS: I ran the complete VStudio .net trial for 60 days and DX9...
8
by: akira2x3x | last post by:
Hello, I get this error while compiling with visualc++ and STL roguewave. With STL microsoft everything work fine. XXXData.cpp f:\xxxxx\product\rw\rcb1.2.0\rm\include\rw\_pair.h(63) : error...
2
by: luca regini | last post by:
This example http://rafb.net/paste/results/YWurKV40.html doesn't seem to work correctly under visualc 7.0. Did anyone experienced the same problem? How did you solve it then? Thanks in...
2
by: Andrea Pisar | last post by:
I tried to call my chm file from VisualC#.Net. First I wrote a little program just to test it ( with Help.Showhelp(this,helpfile)), no problems in this case. Then I did the same in our actual...
3
by: Allonii | last post by:
Hello! Im new to C++ but little used to java! Well my question is how you can connect to a database and then add, delete, etc trough a windows application. Im using visualC++ express...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.