473,387 Members | 1,528 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,387 software developers and data experts.

Don't no whether to laugh

http://msdn.microsoft.com/library/de...l=/library/en-
us/vccore98/HTML/_core_using_strict_type_checking.asp

Pay particular attention to:

The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
types.”
....when is Microsoft gonna cop-on?
-JKop
Jul 22 '05 #1
35 2164

"JKop" <NU**@NULL.NULL> wrote in message
news:tU*******************@news.indigo.ie...
http://msdn.microsoft.com/library/de...l=/library/en-
us/vccore98/HTML/_core_using_strict_type_checking.asp

Pay particular attention to:

The types WPARAM, LPARAM, LRESULT, and void * are "polymorphic data
types."
...when is Microsoft gonna cop-on?
-JKop


I don't think they referred to polymorphism from the OOP point of view. I
think that they meant that a type can have different meanings, depending on
how it is used. For example, WORD can be used as an integer value or as a
reference to an object. This can be somekind of (strange) polymorphism.

Catalin
Jul 22 '05 #2
JKop wrote:
http://msdn.microsoft.com/library/de...l=/library/en-
us/vccore98/HTML/_core_using_strict_type_checking.asp

Pay particular attention to:

The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
types.”
...when is Microsoft gonna cop-on?

A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.

it is true that they aren't any kind of safe or typed polymorphism, but
polymorphism they are.

Perhaps you should be careful before you start insulting microsoft? (or
point to your definition of polymorphic data type?)

Chris
Jul 22 '05 #3
A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.

A polymorphic class is a class which contains one virtual function or more.

it is true that they aren't any kind of safe or typed polymorphism, but
polymorphism they are.

Perhaps you should be careful before you start insulting microsoft? (or
point to your definition of polymorphic data type?)

Microsoft deserves to be insulted. "Visual C++" is not C++ at all, it's C.
Open it up there and make a wizard project - all you get is C code.
-JKop
Jul 22 '05 #4

"JKop" <NU**@NULL.NULL> wrote in message
news:pv*******************@news.indigo.ie...
A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.

A polymorphic class is a class which contains one virtual function or
more.

it is true that they aren't any kind of safe or typed polymorphism, but
polymorphism they are.

Perhaps you should be careful before you start insulting microsoft? (or
point to your definition of polymorphic data type?)

Microsoft deserves to be insulted. "Visual C++" is not C++ at all, it's C.
Open it up there and make a wizard project - all you get is C code.
-JKop


You are getting religious.
Jul 22 '05 #5
chris wrote:
JKop wrote:
http://msdn.microsoft.com/library/de...l=/library/en-
us/vccore98/HTML/_core_using_strict_type_checking.asp

Pay particular attention to:

The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
types.”
...when is Microsoft gonna cop-on?
A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.


Can you make a sample of non polymorphic data type then?
it is true that they aren't any kind of safe or typed polymorphism, but
polymorphism they are.
Then everything is polymorphism more or less.
Perhaps you should be careful before you start insulting microsoft? (or
point to your definition of polymorphic data type?)

Chris

--
Regards,
Slava

Jul 22 '05 #6
Vyacheslav Kononenko wrote:
chris wrote:
JKop wrote:
http://msdn.microsoft.com/library/de...l=/library/en-
us/vccore98/HTML/_core_using_strict_type_checking.asp

Pay particular attention to:

The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
types.”
...when is Microsoft gonna cop-on?

A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.

Can you make a sample of non polymorphic data type then?


OK, these are polymorphic data types in that they are designed and
assumed to hold different types of data. The best example (void*)
satisfies this condition, a void* could be a pointer to an int* or a
char* or a big_struct*.

On the other hand, I would assume an int* just pointed to an int. (While
the c++ standard does guarantte that if you go (A*)( (void*) a ) where a
is a pointer to A is a valid thing to do, I believe it doesn't promise
you can do (A*)( (int*) a ).

Chris
Jul 22 '05 #7

Polymorphism:
Polymorphism is exhibited by a polymorphic class.

A polymorphic class is a class which contains a virtual member function.

A polymorphic class exhibits its polymorphism when a virtual member function
of its is called.

Polymorphism is the concept by which, an object which qualifies as an object
of the polymorphic class, posesses an idicator as to what exact body of code
should be executed when that particular member function is called. One
common way of achieving this is by placing a hidden pointer within the
structure of the object; this hidden pointer is used to determine what
particular body of code is to be executed when a particular member function
of its is called.
Any other definition of "polymorphism" is retarded.
-JKop
Jul 22 '05 #8
chris wrote:
Vyacheslav Kononenko wrote:
chris wrote:
JKop wrote:

http://msdn.microsoft.com/library/de...l=/library/en-
us/vccore98/HTML/_core_using_strict_type_checking.asp

Pay particular attention to:

The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
types.”
...when is Microsoft gonna cop-on?

A polymorphic data type is (I would say, and first few links on
google agree) is a data type which can be store more than one kind of
type. WPARAM, LPARAM, LRESULT and void* all seem to satisfy this
requirement.


Can you make a sample of non polymorphic data type then?


OK, these are polymorphic data types in that they are designed and
assumed to hold different types of data. The best example (void*)
satisfies this condition, a void* could be a pointer to an int* or a
char* or a big_struct*.

On the other hand, I would assume an int* just pointed to an int. (While
the c++ standard does guarantte that if you go (A*)( (void*) a ) where a
is a pointer to A is a valid thing to do, I believe it doesn't promise
you can do (A*)( (int*) a ).

Chris


Does C++ guarantee that long can be casted to a pointer? Will you assume
that long will keep a pointer? Was long designed to hold pointer type?
So does long satisfy this condition?

--
Regards,
Slava

Jul 22 '05 #9

"JKop" <NU**@NULL.NULL> wrote in message
news:pv*******************@news.indigo.ie...
A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.

A polymorphic class is a class which contains one virtual function or
more.


And since when is a "data type" automatically a "class"?

They're referring to data types that can be used in multiple ways. If you've
ever used those LPARAM and WPARAM function parameter types, you'd know how
they're usually used, and can see what they mean by polymorphism. Don't get
too hung up on the C++ use of the term.
it is true that they aren't any kind of safe or typed polymorphism, but
polymorphism they are.

Perhaps you should be careful before you start insulting microsoft? (or
point to your definition of polymorphic data type?)

Microsoft deserves to be insulted. "Visual C++" is not C++ at all, it's C.
Open it up there and make a wizard project - all you get is C code.


Well, technically, that's the wizard, not the compiler. You are certainly
able to "real" C++ code using Visual C++. (Well, at least if you're using
VC++7 or later.)

Not that Bill cares, eh? :-)

-Howard


Jul 22 '05 #10
JKop wrote:
Any other definition of "polymorphism" is retarded.


I'm presuming that includes the dictionary definition:

Main Entry: poly·mor·phism
Pronunciation: "pä-lE-'mor-"fi-z&m
Function: noun
: the quality or state of being able to assume different forms: as a :
existence of a species in several forms independent of the variations of sex
b : the property of crystallizing in two or more forms with distinct
structure

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Jul 22 '05 #11
your description is only half of the truth. the polymorphism you described
is dynamic polymorphism
which is achieved through virtual function calls in c++. but c++ also
enables you to have static
polymorphism through templates so the type is bound on compile time

i think the usage of LPARAM and so on is decisive because it's used
polymorphic. void* is - by it's nature
that it doesn't point on any type or to all types - polymorphic

mfg steven
Am Wed, 27 Oct 2004 14:11:23 GMT schrieb JKop <NU**@NULL.NULL>:

Polymorphism:
Polymorphism is exhibited by a polymorphic class.

A polymorphic class is a class which contains a virtual member function.

A polymorphic class exhibits its polymorphism when a virtual member
function
of its is called.

Polymorphism is the concept by which, an object which qualifies as an
object
of the polymorphic class, posesses an idicator as to what exact body of
code
should be executed when that particular member function is called. One
common way of achieving this is by placing a hidden pointer within the
structure of the object; this hidden pointer is used to determine what
particular body of code is to be executed when a particular member
function
of its is called.
Any other definition of "polymorphism" is retarded.
-JKop


--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/m2/
Jul 22 '05 #12
i can't agree with you - of course you can code in c++ with vc++. i know
the vc6.0-compiler
was very very bad in standard conformity but todays ms-compilers are ok.
and if you create
a project you ain't get only c code
Am Wed, 27 Oct 2004 12:28:05 GMT schrieb JKop <NU**@NULL.NULL>:
A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.

A polymorphic class is a class which contains one virtual function or
more.

it is true that they aren't any kind of safe or typed polymorphism, but
polymorphism they are.

Perhaps you should be careful before you start insulting microsoft? (or
point to your definition of polymorphic data type?)

Microsoft deserves to be insulted. "Visual C++" is not C++ at all, it's
C.
Open it up there and make a wizard project - all you get is C code.
-JKop


--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/m2/
Jul 22 '05 #13
JKop wrote:
Polymorphism:
...
Polymorphism is exhibited by a polymorphic class.
...
Any other definition of "polymorphism" is retarded.
...


Bunch of nonsense. There is "polymorphism" as a strictly defined term in
formal C++ terminology. There's formal term "polymorphism" in biology.
There's formal term "polymorphism" in chemistry. There is finally an
English word "polymorphism". All these are very loosely related (i.e
they are related at a very abstract level). The same can be said about
many other formal C++ terms, like "aggregate", for example. For some
reason you insist on imposing the concrete formal C++ definition on all
other uses of the word. This doesn't make any sense and looks like a
troll post.

--
Best regards,
Andrey Tarasevich
Jul 22 '05 #14

"JKop" <NU**@NULL.NULL> wrote in message
news:f0*******************@news.indigo.ie...

Polymorphism:
Polymorphism is exhibited by a polymorphic class.

A polymorphic class is a class which contains a virtual member function.
That´s true but read your own first sentence again. It says that
polymorphism is exhibited by a polymorphic class but it does NOT say that
this is true for classes only. The original citation you gave was walking
about polymorphic data types, which does not necessarily mean classes!

A polymorphic class exhibits its polymorphism when a virtual member function of its is called.

That´s not completely true because you omitt static polymorphism.
Polymorphism is the concept by which, an object which qualifies as an object of the polymorphic class, posesses an idicator as to what exact body of code should be executed when that particular member function is called. One
common way of achieving this is by placing a hidden pointer within the
structure of the object; this hidden pointer is used to determine what
particular body of code is to be executed when a particular member function of its is called.
Any other definition of "polymorphism" is retarded.


Says who?

Cheers
Chris
Jul 22 '05 #15

"JKop" <NU**@NULL.NULL> wrote in message
news:pv*******************@news.indigo.ie...
[SNIP]
Microsoft deserves to be insulted. "Visual C++" is not C++ at all, it's C.
Open it up there and make a wizard project - all you get is C code.


Relax & take a deep breath. Insultation & starting a religious flame war
will bring you nowhere, and BTW there are some very gifted people working at
the aforementioned company. Furthermore nobody ever forced you to use the
wizard and to be more exact you can use "real" C++ code with Visual C++, but
(as with any decent C++ compiler) you should be able to run C code as well.
Whatever you make of it, it is up to you.

Cheers
Chris
Jul 22 '05 #16
JKop wrote:
A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.
A polymorphic class is a class which contains one virtual function or more.


As it says in the text, and as you originally quoted, the 'polymorphism' is
with respect to a data type, not a (OO) class. There are very real differences
in meanings of the word, depending on its application.

Further, the Win32 API is a C interface, therefore such specific applications
of the C++ polymorphism term do not apply.

it is true that they aren't any kind of safe or typed polymorphism, but
polymorphism they are.

Perhaps you should be careful before you start insulting microsoft? (or
point to your definition of polymorphic data type?)


Microsoft deserves to be insulted. "Visual C++" is not C++ at all, it's C.
Open it up there and make a wizard project - all you get is C code.


The product is called Microsoft Visual C++, which is composed of several
components: The compiler/linker, the IDE, etc.

The wizards are strictly part of the IDE, and the code it generates has
absolutely no bearing on the underlying conformance of the C++ compiler.

You may probably want to review your original statement and revise it to
something like "Visual C++ isn't _visual_ at all", which is definitely a more
accurate analysis.

Regardless, this is all off-topic in this forum. If you have a question about
standards conformance, refer to comp.std.c++; if you have a question about the
MSVC suite, refer to microsoft.public.*.msvc and related.

Finally, what is the point of your post as it relates to the topicality of this
forum?
Jul 22 '05 #17
JKop wrote:
http://msdn.microsoft.com/library/de...l=/library/en-
us/vccore98/HTML/_core_using_strict_type_checking.asp

Pay particular attention to:

The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
types.”
...when is Microsoft gonna cop-on?

This is Win32 API, that is a C API. So the term "polymorphic" does not
mean a virtual member function.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #18
Ioannis Vranos wrote:
Probably you and JKop are familiar with pre-standard versions of VC++.
Check the screen-shot attached (the same applies for VC++ 2002 and 2003).

Actually VC++ 2002 lacks the RAD (more accurate terminology: the Designer).

VC++ has the same RAD with VB and VC#. The language itself is more
powerful though.


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #19
JKop wrote:
Polymorphism:
Polymorphism is exhibited by a polymorphic class.

A polymorphic class is a class which contains a virtual member function.

A polymorphic class exhibits its polymorphism when a virtual member function
of its is called.

Polymorphism is the concept by which, an object which qualifies as an object
of the polymorphic class, posesses an idicator as to what exact body of code
should be executed when that particular member function is called. One
common way of achieving this is by placing a hidden pointer within the
structure of the object; this hidden pointer is used to determine what
particular body of code is to be executed when a particular member function
of its is called.
Any other definition of "polymorphism" is retarded.


With critical expressions aside, I guess that what the documentation you
initially mentioned means with "polymorphic types", is more accurately
generic programming. And indeed the generic programming tasks in C is
made by using void * and the appropriate casts, for example you create a
function getting void * and another type identification argument like an
int or a char * or whatever, and based on this second parameter you make
the appropriate casts and operations.
Provided that Win32 is very old (and I guess it is Win16 adapted to
Windows 9x/NT, and in this case very very old), since it is of Windows
95 time, and given that there wasn't even a C++ official standard yet,
and templates had not taken their final form (and probably not even
invented!), I guess the part of documentation you are referring to must
have been since that time.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #20
"Catalin Pitis" <ca***********@iquestint.com.renameme> wrote:

The types WPARAM, LPARAM, LRESULT, and void * are "polymorphic data
types."

I don't think they referred to polymorphism from the OOP point of view. I
think that they meant that a type can have different meanings, depending on
how it is used. For example, WORD can be used as an integer value or as a
reference to an object.


What amuses me is that DWORD means a single word and QWORD
means a double word, on most Windows systems.
Jul 22 '05 #21
Old Wolf wrote:

"Catalin Pitis" <ca***********@iquestint.com.renameme> wrote:

The types WPARAM, LPARAM, LRESULT, and void * are "polymorphic data
types."

I don't think they referred to polymorphism from the OOP point of view. I
think that they meant that a type can have different meanings, depending on
how it is used. For example, WORD can be used as an integer value or as a
reference to an object.


What amuses me is that DWORD means a single word and QWORD
means a double word, on most Windows systems.


Yes, an inaccurate hold-over from the earlier Wintel days when the CPU
architecture was 16-bit word.
Jul 22 '05 #22

"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:A6*****************@mencken.net.nih.gov...
chris wrote:
Vyacheslav Kononenko wrote:
chris wrote:

JKop wrote:

> http://msdn.microsoft.com/library/de...l=/library/en-
> us/vccore98/HTML/_core_using_strict_type_checking.asp
>
> Pay particular attention to:
>
> The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
> types.”
>
>
> ...when is Microsoft gonna cop-on?
>
A polymorphic data type is (I would say, and first few links on google
agree) is a data type which can be store more than one kind of type.
WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.

Can you make a sample of non polymorphic data type then?


OK, these are polymorphic data types in that they are designed and
assumed to hold different types of data. The best example (void*)
satisfies this condition, a void* could be a pointer to an int* or a
char* or a big_struct*.

On the other hand, I would assume an int* just pointed to an int. (While
the c++ standard does guarantte that if you go (A*)( (void*) a ) where a
is a pointer to A is a valid thing to do, I believe it doesn't promise
you can do (A*)( (int*) a ).

Chris


Does C++ guarantee that long can be casted to a pointer? Will you assume
that long will keep a pointer? Was long designed to hold pointer type? So
does long satisfy this condition?


C++ doesn't guaratee this. However, on Windows (we are talking about WinAPI)
you can do this.

Catalin
Jul 22 '05 #23

"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:A6*****************@mencken.net.nih.gov...
chris wrote:
Vyacheslav Kononenko wrote:
chris wrote:

JKop wrote:

> http://msdn.microsoft.com/library/de...l=/library/en-
> us/vccore98/HTML/_core_using_strict_type_checking.asp
>
> Pay particular attention to:
>
> The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
> types.”
>
>
> ...when is Microsoft gonna cop-on?
>
A polymorphic data type is (I would say, and first few links on
google agree) is a data type which can be store more than one kind of
type. WPARAM, LPARAM, LRESULT and void* all seem to satisfy this
requirement.

Can you make a sample of non polymorphic data type then?


OK, these are polymorphic data types in that they are designed and
assumed to hold different types of data. The best example (void*)
satisfies this condition, a void* could be a pointer to an int* or a
char* or a big_struct*.

On the other hand, I would assume an int* just pointed to an int. (While
the c++ standard does guarantte that if you go (A*)( (void*) a ) where a
is a pointer to A is a valid thing to do, I believe it doesn't promise
you can do (A*)( (int*) a ).

Chris


Does C++ guarantee that long can be casted to a pointer?

[SNIP]

Hmm, I don´t think that the language guarantees this, aat least I haven´t
yet stumbled over an explicit statement regarding this issue. However, you
know that you can swing C-style casts like a hammer ;-) and this approach is
commonly used and works if you´re for example accessing objects via pointers
from the VBScript engine.

Chris
Jul 22 '05 #24
Chris Theis wrote:
"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:A6*****************@mencken.net.nih.gov...
chris wrote:

Vyacheslav Kononenko wrote:
chris wrote:
>JKop wrote:
>
>
>>http://msdn.microsoft.com/library/de...l=/library/en-
>>us/vccore98/HTML/_core_using_strict_type_checking.asp
>>
>>Pay particular attention to:
>>
>>The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
>>types.”
>>
>>
>>...when is Microsoft gonna cop-on?
>>
>
>
>A polymorphic data type is (I would say, and first few links on
>google agree) is a data type which can be store more than one kind of
>type. WPARAM, LPARAM, LRESULT and void* all seem to satisfy this
>requirement.

Can you make a sample of non polymorphic data type then?
OK, these are polymorphic data types in that they are designed and
assumed to hold different types of data. The best example (void*)
satisfies this condition, a void* could be a pointer to an int* or a
char* or a big_struct*.

On the other hand, I would assume an int* just pointed to an int. (While
the c++ standard does guarantte that if you go (A*)( (void*) a ) where a
is a pointer to A is a valid thing to do, I believe it doesn't promise
you can do (A*)( (int*) a ).

Chris


Does C++ guarantee that long can be casted to a pointer?


[SNIP]

Hmm, I don´t think that the language guarantees this, aat least I haven´t
yet stumbled over an explicit statement regarding this issue. However, you
know that you can swing C-style casts like a hammer ;-) and this approach is
commonly used and works if you´re for example accessing objects via pointers
from the VBScript engine.

Chris

OK looks like your previous definition does not work for LPARAM then. So
can you make an example on non polymorphic data type? Or clearly specify
how can we separate where is polymorphic data type and where is not?

--
Regards,
Slava

Jul 22 '05 #25

"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:Po*****************@mencken.net.nih.gov...

OK looks like your previous definition does not work for LPARAM then. So
can you make an example on non polymorphic data type? Or clearly specify
how can we separate where is polymorphic data type and where is not?


Given the ability to cast, there really is no difference. It's mainly one
of intention. Those parameter (and return) types were *intended* to be
cast to other types, as a kind of "generic" place-holder for information.
The only thing that really makes them "polymorphic" is how they're used,
nothing inherent in the types themselves.

So, I guess the answer to both your questions is "no". :-)

-Howard

Jul 22 '05 #26
In message <2u*************@uni-berlin.de>, Catalin Pitis
<ca***********@iquestint.com.renameme> writes

"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:A6*****************@mencken.net.nih.gov...
chris wrote:
Vyacheslav Kononenko wrote:

chris wrote:

> JKop wrote:
>
>> http://msdn.microsoft.com/library/de...l=/library/en-
>> us/vccore98/HTML/_core_using_strict_type_checking.asp
>>
>> Pay particular attention to:
>>
>> The types WPARAM, LPARAM, LRESULT, and void * are “polymorphic data
>> types.”
>>
>>
>> ...when is Microsoft gonna cop-on?
>>
>
>
> A polymorphic data type is (I would say, and first few links on google
> agree) is a data type which can be store more than one kind of type.
> WPARAM, LPARAM, LRESULT and void* all seem to satisfy this requirement.

Can you make a sample of non polymorphic data type then?
OK, these are polymorphic data types in that they are designed and
assumed to hold different types of data. The best example (void*)
satisfies this condition, a void* could be a pointer to an int* or a
char* or a big_struct*.

On the other hand, I would assume an int* just pointed to an int. (While
the c++ standard does guarantte that if you go (A*)( (void*) a ) where a
is a pointer to A is a valid thing to do, I believe it doesn't promise
you can do (A*)( (int*) a ).

Chris


Does C++ guarantee that long can be casted to a pointer? Will you assume
that long will keep a pointer? Was long designed to hold pointer type? So
does long satisfy this condition?


C++ doesn't guaratee this. However, on Windows (we are talking about WinAPI)
you can do this.

The standard (5.2.10) _does_ guarantee that you can reinterpret_cast a
pointer to an integral type and back again without changing its value,
provided that the integral type is large enough to hold it.

--
Richard Herring
Jul 22 '05 #27

"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:Po6gd.1749[SNIP]

OK looks like your previous definition does not work for LPARAM then. So
can you make an example on non polymorphic data type? Or clearly specify
how can we separate where is polymorphic data type and where is not?


Howard was faster in his response and there is not much to add. In principle
they´re used as placeholders which you´ll see very often in windows
programming. For example you cast pointers to arbitrary objects to DWORD*
and attach them to listbox items. However, this is far from the standard and
very MS specific.

HTH
Chris
Jul 22 '05 #28
Chris Theis wrote:
"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:Po6gd.1749[SNIP]

OK looks like your previous definition does not work for LPARAM then. So
can you make an example on non polymorphic data type? Or clearly specify
how can we separate where is polymorphic data type and where is not?

Howard was faster in his response and there is not much to add. In principle
they´re used as placeholders which you´ll see very often in windows
programming. For example you cast pointers to arbitrary objects to DWORD*
and attach them to listbox items. However, this is far from the standard and
very MS specific.

HTH
Chris

So can we rephrase your: "A polymorphic data type is (I would say, and
first few links on google agree) is a data type which can be store more
than one kind of type. WPARAM, LPARAM, LRESULT and void* all seem to
satisfy this requirement." to "In their definition MS developers mean a
polymorphic data type as data type which is intended to be cast to other
types (properly or not which is another big question)" ?

--
Regards,
Slava

Jul 22 '05 #29
Chris Theis wrote:
"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:Yacgd.1759[SNIP]
So can we rephrase your: "A polymorphic data type is (I would say, and
first few links on google agree) is a data type which can be store more
than one kind of type. WPARAM, LPARAM, LRESULT and void* all seem to
satisfy this requirement." to "In their definition MS developers mean a
polymorphic data type as data type which is intended to be cast to other
types (properly or not which is another big question)" ?

Well, I´m sorry to tell you that you cannot rephrase my "A polymorphic data
type...." because it´s not my statement. If you read the name of the poster
carefully it says "chris" but not "Chris Theis" ;-)

Oh I am sorry, I've completely lost.
However, what it boils down to is yes - polymorphic data type is a data type
which can be transformed to any distinct type as required. It´s created by
the use of a generic pointer (e.g., void*) which simply points to an address
without an associated type.
OK looks like we started again. Any data type is polymorphic in such
definition, isn't it? For example we can use "char" as an offset to a
object of some type in the array. Any data type is a number by nature
and what that number means only determined by how we use it. So I don't
see the way you can make a definition of polymorphic data type by what
it can hold. It can hold a set of bits and nothing more.
Cheers
Chris


--
Regards,
Slava

Jul 22 '05 #30

"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:hW*****************@mencken.net.nih.gov...
Chris Theis wrote:
"Vyacheslav Kononenko" <vy********@NOkononenkoSPAM.net> wrote in message
news:Yacgd.1759[SNIP]

So can we rephrase your: "A polymorphic data type is (I would say, and
first few links on google agree) is a data type which can be store more
than one kind of type. WPARAM, LPARAM, LRESULT and void* all seem to
satisfy this requirement." to "In their definition MS developers mean a
polymorphic data type as data type which is intended to be cast to other
types (properly or not which is another big question)" ?

Well, I´m sorry to tell you that you cannot rephrase my "A polymorphic data type...." because it´s not my statement. If you read the name of the poster carefully it says "chris" but not "Chris Theis" ;-)

Oh I am sorry, I've completely lost.

However, what it boils down to is yes - polymorphic data type is a data type which can be transformed to any distinct type as required. It´s created by the use of a generic pointer (e.g., void*) which simply points to an address without an associated type.


OK looks like we started again. Any data type is polymorphic in such
definition, isn't it? For example we can use "char" as an offset to a
object of some type in the array. Any data type is a number by nature
and what that number means only determined by how we use it. So I don't
see the way you can make a definition of polymorphic data type by what
it can hold. It can hold a set of bits and nothing more.


In principle you already phrased what I meant: "In their definition MS
developers mean a
polymorphic data type as data type which is intended to be cast to other
types (properly or not which is another big question)" ?

You can use a reinterpret_cast to cast a pointer to an integral type and
back again, without changing the value of the pointee. The only requirement
is that the integral type is large enough. This is something which is
commonly done under Windows. For example think of the following situation,
which is not OS specific. You´re implementing a listbox and want to provide
a mechanism that the users can attach whatever objects they have created to
an item in the listbox. However, you do not know anything about the objects
because they have not been implemented at the time you´re writing your GUI.
So what you need is a generic pointer (which equals a polymorphic data
type). This is exactly what is done with the MFC listbox classes where the
user can attach his objects by casting them to DWORD pointers. Consequently
the polymorphic data type is not a data type in the common sense like
int/double/etc, but rather a generic pointer which can be used to store
pointers to objects of whatever types you like. Naturally, you´ll loose the
original type information by the cast & have to recast correctly before
accessing the pointee.

Cheers
Chris
Jul 22 '05 #31
Vyacheslav Kononenko wrote:
OK looks like we started again. Any data type is polymorphic in such
definition, isn't it? For example we can use "char" as an offset to a
object of some type in the array. Any data type is a number by nature
and what that number means only determined by how we use it. So I don't
see the way you can make a definition of polymorphic data type by what
it can hold. It can hold a set of bits and nothing more.

You are following a wrong path here.
As I said in another message, in C++ the term polymorphism means a
"run-time type identification" in calling the appropriate member function.
As it was used in this Win32 API it means generic programming. In C
generic programming is done by using void * and the appropriate casts.


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #32
>As I said in another message, in C++ the term polymorphism means a
"run-time type identification" in calling the appropriate member function.


You don't consider function overloading and class and function generation via
templates to be forms of polymorphism?

I have heard numerous others refer to them as such.
Jul 22 '05 #33
DaKoadMunky wrote:
As I said in another message, in C++ the term polymorphism means a
"run-time type identification" in calling the appropriate member function.

You don't consider function overloading

Yes this is what I meant above, virtual member functions.
and class and function generation via
templates to be forms of polymorphism?


That is more accurately termed as generic programming in C++ world.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #34
>> You don't consider function overloading


Yes this is what I meant above, virtual member functions.


Having a derived class implement a virtual function declared in a base class is
overriding, not overloading.

Overloading is having more than one function with the same name in the same
scope.

The former is a form of dynamic polymorphism.

The latter is a form of static polymorphism.

That is if you believe this fellow...

http://www.research.att.com/~bs/glos...l#Goverloading
http://www.research.att.com/~bs/glos...ml#Goverriding
http://www.research.att.com/~bs/glos...#Gpolymorphism

His credentials seem solid :)



Jul 22 '05 #35
DaKoadMunky wrote:
Having a derived class implement a virtual function declared in a base class is
overriding, not overloading.

Overloading is having more than one function with the same name in the same
scope.

The former is a form of dynamic polymorphism.

The latter is a form of static polymorphism.

That is if you believe this fellow...

http://www.research.att.com/~bs/glos...l#Goverloading
http://www.research.att.com/~bs/glos...ml#Goverriding
http://www.research.att.com/~bs/glos...#Gpolymorphism

His credentials seem solid :)

OK, very interesting. So in other words, virtual member functions is
dynamic polymorphism, and generic programming (including overloaded
functions) is static polymorphism.
Very interesting. Thanks for the info.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #36

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

Similar topics

0
by: sandy pittendrigh | last post by:
Hi Nadya: ....not sure how long this will work. But if you go to Google, type in "weapons of mass destruction" and then hit the "I'm feeling lucky" button ....well, it made me laugh.
303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
16
by: mike420 | last post by:
Tayss wrote: > > app = wxPySimpleApp() > frame = MainWindow(None, -1, "A window") > frame.Show(True) > app.MainLoop() > Why do you need a macro for that? Why don't you just write
8
by: middletree | last post by:
I had some text links at the top of all my pages (in one include file), which worked just fine. But I was asked to make it so that people in a certain department, (this is an Intranet app) would...
65
by: Pmb | last post by:
I'm confused as to what the compiler error message I'm getting is refering to. Can someone take a gander and let me know what I did wrong? The program is below. When I compile it I get the...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
5
by: HankD | last post by:
I get the following error when I add a new application to our server. If I run aspnet_regiis -i it takes care of the problem but when I add another application I get the same error for the second...
170
by: I_AM_DON_AND_YOU? | last post by:
Whether we can upload the projects (in .zip format) in these newsgroups? I am asking this because earlier there are more than 50 posts (in one thread) about this query and they are contradicting...
9
by: Johnny Jörgensen | last post by:
Hi y'all I've got a custom control that is inherited from a normal TextBox. To that, I've added a new property that I call "Units", Which is a collection class containing members of a "Unit"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.