[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

_getch and microsoft claims

vippstar

12/13/2008 12:04:00 PM

Hello comp.lang.c++

I was reading Microsofts documentation and I stumbled upon this:
<http://msdn.microsoft.com/en-us/librar...(VS.80).aspx>

Quote from that page:
> getch
>
> This POSIX function is deprecated beginning in Visual C++ 2005
> Use the ISO C++ conformant _getch instead.

That's really funny considering that getch is not a POSIX function
(according to IEEE-1003.1-2004, it doesn't mention it), and that from
a word search I performed in my ISO/IEC 14882:2003 document I found no
mention of _getch.

While I trust the word search I performed with POSIX, I don't trust
the search provided by my pdf software, so I'd appreciate any comments
regarding _getch. Any ideas what they're talking about?
5 Answers

Jean-Marc Bourguet

12/13/2008 12:24:00 PM

0

vippstar@gmail.com writes:

> Hello comp.lang.c++
>
> I was reading Microsofts documentation and I stumbled upon this:
> <http://msdn.microsoft.com/en-us/librar...(VS.80).aspx>
>
> Quote from that page:
>> getch
>>
>> This POSIX function is deprecated beginning in Visual C++ 2005
>> Use the ISO C++ conformant _getch instead.
>
> That's really funny considering that getch is not a POSIX function
> (according to IEEE-1003.1-2004, it doesn't mention it),

There is a getch in curses, a unix library which isn't described by POSIX.
But I doubt very much that the getch/_getch from VC++ is the one from
curses.

> and that from a word search I performed in my ISO/IEC 14882:2003 document
> I found no mention of _getch.

I guess by "ISO C++ conformant" they mean that the identifier _getch is one
of those reserved for implementation while getch isn't.

Yours,

--
Jean-Marc

vippstar

12/13/2008 12:30:00 PM

0

On Dec 13, 2:24 pm, Jean-Marc Bourguet <j...@bourguet.org> wrote:
> vipps...@gmail.com writes:
> > Hello comp.lang.c++
>
> > I was reading Microsofts documentation and I stumbled upon this:
> > <http://msdn.microsoft.com/en-us/librar...(VS.80).aspx>
>
> > Quote from that page:
> >> getch
>
> >> This POSIX function is deprecated beginning in Visual C++ 2005
> >> Use the ISO C++ conformant _getch instead.
>
> > That's really funny considering that getch is not a POSIX function
> > (according to IEEE-1003.1-2004, it doesn't mention it),
>
> There is a getch in curses, a unix library which isn't described by POSIX.
> But I doubt very much that the getch/_getch from VC++ is the one from
> curses.

However, there's a header in POSIX, named curses.h. It does not
provide getch. (I'm not saying you don't know this; I just wanted
mention it)

> > and that from a word search I performed in my ISO/IEC 14882:2003 document
> > I found no mention of _getch.
>
> I guess by "ISO C++ conformant" they mean that the identifier _getch is one
> of those reserved for implementation while getch isn't.

Oh yes, that's right. That's probably what they meant.

thanks.

Bo Persson

12/13/2008 12:31:00 PM

0

vippstar@gmail.com wrote:
> Hello comp.lang.c++
>
> I was reading Microsofts documentation and I stumbled upon this:
> <http://msdn.microsoft.com/en-us/librar...(VS.80).aspx>
>
> Quote from that page:
>> getch
>>
>> This POSIX function is deprecated beginning in Visual C++ 2005
>> Use the ISO C++ conformant _getch instead.
>
> That's really funny considering that getch is not a POSIX function
> (according to IEEE-1003.1-2004, it doesn't mention it), and that
> from a word search I performed in my ISO/IEC 14882:2003 document I
> found no mention of _getch.
>
> While I trust the word search I performed with POSIX, I don't trust
> the search provided by my pdf software, so I'd appreciate any
> comments regarding _getch. Any ideas what they're talking about?

They are talking about the naming of the function. :-)

Names starting with an underscore is reserved for the implementation
(in the global namespace). This means that, like you noticed, the ISO
C++ standard doesn't let them use the name getch, but _getch is
allowed.


Bo Persson


Paavo Helde

12/15/2008 9:59:00 PM

0

vippstar@gmail.com kirjutas:

> Hello comp.lang.c++
>
> I was reading Microsofts documentation and I stumbled upon this:
> <http://msdn.microsoft.com/en-us/librar...(VS.80).aspx>
>
> Quote from that page:
>> getch
>>
>> This POSIX function is deprecated beginning in Visual C++ 2005

I'm not really a believer in conspiracy theories, but I do believe this
deprecation is a smart attempt by Microsoft for suppressing Unix/Linux.
They try to get you to change your code so it would not compile under Linux
any more. And they try to make you believe it's for better conformance with
C++ standard. No thanks, if I include a POSIX header, I want to get POSIX
functions, with POSIX standard names, that's it.

OK, all this has nothing to do with getch(), which is MS own invention and
AFAIK has no relation to POSIX getch. I guess it has been labelled as POSIX
by a mistake.

Paavo

James Kanze

12/16/2008 10:44:00 AM

0

On Dec 13, 1:30 pm, vipps...@gmail.com wrote:
> On Dec 13, 2:24 pm, Jean-Marc Bourguet <j...@bourguet.org> wrote:
> > vipps...@gmail.com writes:

> > There is a getch in curses, a unix library which isn't
> > described by POSIX. But I doubt very much that the
> > getch/_getch from VC++ is the one from curses.

> However, there's a header in POSIX, named curses.h. It does
> not provide getch. (I'm not saying you don't know this; I just
> wanted mention it)

It's a separate standard from Posix/Unix, but it's specified by
the same organization (The Open Group), and according to the
specification, it should contain a function (or macro) getch.
(See http://www.opengroup.org/onlinepubs/7990989775/cur....)

--
James Kanze (GABI Software) email:james.kanze@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