Re: Moving from C++ to VC++

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



William DePalo [MVP VC++] wrote:
"Victor Bazarov" <v.Abazarov@xxxxxxxxxxxx> wrote in message news:OUJQpDdcFHA.2736@xxxxxxxxxxxxxxxxxxxxxxx

What's wrong with assuming that "long has the length of the maximal
integer for the hardware"?


Because it is an assumption that is not guaranteed to be true. A long doesn't have to be wider than an int - it just can't be narrower.

The statement about the assumption "not guaranteed to be true" and your explanation make an unnecessary assumption about the meaning of "maximal". I never asked for exclusivity. If there is more than one type that has the corresponding "maximally long hardware type", fine. What I don't understand here is the absence of a standard _arithmetic_ type when the hardware could provide it, and making excuses with some "backward compatibility" claim.

['int' times 'int'] may not fit in an 'int' but should probably fit in a 'long'.


Probably? What is "probable" has no bearing here.

Yes, it has. I am trying to show you what would make more sense for a programmer than "we'll just keep it the same as it was".

Now, how many lines of code were broken when Windows moved from 16-bit
ints to 32-bit ints?


Lots.


What did people do about it?


They fixed them.

So, wouldn't it be logical to continue the same line of thought and guess that if (heaven forbid) we suddenly have 64-bit 'long' on the new 64-bit platform, those who will switch to that platform will fix breakage caused by the change? And, again, I am talking only about 'long' standard C++ type, not 'DWORD', which can happily stay 32 bits.

Was that perceived as  unnecessary pain or was it just necessary to
be able to use 32 bits from that point on?


It was perceived by most to be necessary because the 16 bit platform was in _reality_ as well as in perception inadequate for the tasks at hand.

So, at this point, is there perception that the 32-bit platform is inadequate for certain tasks? Is that perception what forces the progress to the 64-bit platform? Is the inadequateness generic (as you make it sound for the 16-bit case) or is it only limited to certain application areas? IOW, will the 32-bit platform still be adequate for some (if not most) of the stuff we do?

What if when moving to WinNT (in 1994?), MS decided to
keep 'int' 16 bits along with UINT and WORD and WPARAM...

? Isn't that what we have happening now?

Nope. We have more capable hardware and precious few mass market applications that find the current hardware inadequate. We also have a real operating system. 16 bit Windows was remarkable only in its ability to do so much with so little in its quaint little way.

So, the conclusion here is... ??? If the breakage does occur (only on the 64-bit platform), couldn't it be dealt with giving thus more freedom to those who need a better standard C++ type layout instead of holding them back? You yourself seem to imply that there are not so many mass market applications that porting _them_ to Win64 with a 64-bit 'long' shouldn't really be a problem...

I can't imagine that after the Win64 is out everybody is going to get
a copy immediately and if porting of all those applications that everybody
uses on the daily basis is delayed because if 32->64 bit 'long' change,
the World is going to end.  No friggin' way.

V
.



Relevant Pages

  • Re: integer size and portability-a wishful controversy
    ... >> BTW, there is no point in using the old Turbo C compiler, unless ... I do NOT consider programs relying on int having at least 32 bits as ... use the PC as an almost freestanding platform for developing/testing ... device drivers for various pieces of PC hardware. ...
    (comp.lang.c)
  • Re: different struct sizes
    ... You require libraries compiled for your platform (Same Hardware ... GLOBALjpeg_CreateDecompress (j_decompress_ptr cinfo, int version, ... JPEG parameter struct mismatch: library thinks size is 452, ...
    (comp.lang.c)
  • Re: GCC difference in size of long int on Suse SLES9 / Suse Professional 10.0
    ... The kernel uses printf() with 'long int', ... I can't compile 'on-the-fly'. ... clashing with the hardware and any libs that you interact with. ... platform types build up their own int types. ...
    (comp.os.linux.development.apps)
  • [PATCH 4/7] Add mISDN DSP
    ... It may use hardware features if available. ... * of the GNU General Public License, ... +extern int dsp_options; ... * each conference has a unique number, ...
    (Linux-Kernel)
  • Re: A One-Console Future? No Xbox, No PS3, No Wii? (article)
    ... Just like there's only OS and one hardware platform for PCs... ... massive paradigm shift to the industry,where games would become better ... Console games still tend to evolve pretty fast as compared to other ...
    (alt.games.video.xbox)