R
raashid bhatt
what is the diffrence between
typedef void (__cdecl *PyClean)(void);
void (__cdecl *PyClean)(void);
typedef void (__cdecl *PyClean)(void);
void (__cdecl *PyClean)(void);
what is the diffrence between
typedef void (__cdecl *PyClean)(void); void (__cdecl *PyClean)(void);
raashid bhatt said:what is the diffrence between
typedef void (__cdecl *PyClean)(void);
void (__cdecl *PyClean)(void);
Keith Thompson said:Ignoring the "__cdecl", the first declared PyClean as an alias for the
type "void (*)(void)" (pointer to function with no parameters
returning void), and the second declares PyClean as an object of that
type.
"__cdecl" is probably a compiler-specific extensions. To find out
what it means, you'll need to consult the documentation for your
compiler. It's not a standard C feature.
What is the real question behind this question? Did you not know what
"typedef" means? The "Py" prefix leads me to suspect this has
something to do with Python; if so, comp.lang.python might be a better
place to ask -- though I'm sure they'll want more context than you've
provided.
cr88192 said:you don't know what __cdecl is?...
well, maybe not, since it requires using one of the many compilers that
target, of all archs, x86... with such obscure names as, gcc, msvc, intel,
watcom, ...
cr88192 said:you don't know what __cdecl is?...
well, maybe not, since it requires using one of the many compilers that
target, of all archs, x86... with such obscure names as, gcc, msvc, intel,
watcom, ...
Well I've been using x86 for a very long time and I've certainly nevercr88192 said:you don't know what __cdecl is?...
well, maybe not, since it requires using one of the many compilers that
target, of all archs, x86... with such obscure names as, gcc, msvc, intel,
watcom, ...
actually, I doubt there is any real major compilers for x86 that don't know
these keywords,
you don't know what __cdecl is?...
well, maybe not, since it requires using one of the many compilers that
target, of all archs, x86... with such obscure names as, gcc, msvc, intel,
watcom, ...
Richard Heathfield said:Ian Collins said:
Right. It's not actually necessary. It once occurred to me to bother to
find out what it means, so I did, and it sounded terribly, terribly dull
and pointless - so I didn't bother to remember it.
ISTR that MSVC litters its headers with _cdecl, but C programmers are
under
no obligation whatsoever to follow suit.
James Kuyper said:cr88192 wrote:
...
It's not supported in default mode by the gcc compiler installed on the
intel x86 machines I use at work, nor the x86_64 machine I have at home.
"info gcc" doesn't give me any information about it. If I need a special
command line option to turn it on, I don't know which option that is.
I won't pretend ignorance of the keyword, but I am unfamiliar with it,
I've had no reason to even think about it in more than a decade.
cr88192 said:well, x86!=x86_64, I would be surprised if they work on x86-64...
now, it sounds to me like maybe you are using something like Linux,
> ... which
does not normally use these keywords, none the less, gcc itself has them for
the reason that they are needed for it to target Windows...
Stephen Sprunk said:By virtue of having two leading underscores, __cdecl is in the namespace
reserved to implementations and, without naming the specific
implementation used, we cannot make any assumptions about what it means --
and if named, it would still be off-topic.
<OT>However, all of us know that it's almost certainly to be a common
extension that specifies the calling convention used by a function, like
__stdcall and _fastcall, usually only encountered on Windows systems but
sometimes available on other x86 systems. That has no bearing on the OP's
question about "typedef", though.</OT>
cr88192 said:it does matter a lot to people who write compilers though...
unless of course, one is writing libraries, or they feel inclined to use the
__stdcall convention (generally expected for most libraries with a DLL based
interface).
James Kuyper said:I wasn't sure whether you'd consider x86_64 as a special case of x86. My
own code has no need to worry about the differences between x86 and
x86_64 - it's written to perform the same operations in either case.
Good guess! Not all of the world (not even all of the x86 world) is a
Windows.
I can't find any mention of them in "info gcc", though it mentions many
other features that are Windows specific.
cr88192 said:none the less, presumably people should know how things work in windows,
rather than acting like all this stuff is a big mystery...
cr88192 said:only if one sticks by this certain fantasy in these parts, that one uses C
apart from computers...
yes, I was not trying to imply that it was particularly relevant, more just
complaining about the apparent ignorance of this keyword on the part of the
person responding (to me, this comming off as a fair deal of ignorance as to
what it is actual coders are faced with...).
real world code involves many such things, and it is generally good to know
them, of all things, so that the code actually works, and is capable of
doing all these mundane tasks that people here like to regard as
"impossible...".
it is analogous to me of like:
a biologist who is ignorant of centrifuges (or considers that the actual
practice of using tools and actual organisms to study biology is below
them);
an automotive specialist who does not know about things like socket sets, or
about the difference between socket for hand-driven wrenches and impact
sockets (or thinks it is demeaning to actually work on cars);
abstractions apart from the reality is, IMO, distasteful.
but, then again, this could just be my ExTJ side showing...
Richard Heathfield said:Keith Thompson said:
I disagree, since you imply that some does. None does. If the use of
__cdecl is required, what we're doing isn't C programming any more. That
doesn't mean that what we're doing isn't good and useful - but C it ain't.
<snip>
C with extensions is still C. That doesn't mean it's good or useful,
but it's still C -- as the standard specifically acknowledges.
Richard Heathfield said:Keith Thompson said:
Only when being compiled on an implementation that supports those
extensions with that syntax and those semantics. On implementations that
don't, it's just an error.
It's the same problem as void main. C99 tried to "fix" void main (and
double main, and struct tm **main) by, in a sense, codifying different
syntaxes for main - but did so in a way that is inherently meaningless.
Yes, extensions are part of C in the sense that C compilers can accept
(and even define) them, but they are not part of C in the sense that
compilers can reject them.
Consider this:
now is the time for all good men to come to the aid of their party
cr88192 said:none the less, presumably people should know how things work in windows,
rather than acting like all this stuff is a big mystery...
possibly, no one bothered to write about it.
it is one of those things that is needed to make code and libraries work
right on Windows, ...
I just get tired here of people always ignoring or denying the existence of
stuff like the stack, the linker, libraries, ... which are important to know
about for anyone to actually effectively make use of the language.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.