To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2240
2239  |  2241
Subject: 
Re: thread class for legOS
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Mon, 21 Jan 2002 15:47:09 GMT
Viewed: 
1747 times
  
On Mon, 21 Jan 2002, Michael J Ash wrote:

On Mon, 21 Jan 2002, John A. Tamplin wrote:

No, static doesn't matter but it is possible the calling conventions of C
and C++ might be different (I don't know of a platform where that is the
case for a an extern function), so you might need to specify C linkage,
as in:

Static DOES matter; it declares the method as being a "class" method,
rather than a normal instance method. I believe there is no implicit
'this' parameter and therefore it can be treated like a normal function.
Of course, it can't be linked with any instance of the class, so you'd
have to treat it as a wrapper.

Unless you define a function as a member function, there is no this
parameter at all.  In the example given, it was not a member function at
all (nor should it be).

I believe you are thinking of a static member function vs. a non-static
member function, in which case you are correct -- a non-static member
function will never work.  However, there is no guarantee that C will be
able to call a C++ static member function at all.  It may work on many
platforms, but the standard doesn't require it at all (in fact on most
platforms you can probably call a member function by supplying your own
this parameter).  There are many things that C++ can do differently, such
as handling exceptions propagated into C code. If you want to write
portable code, you will use C linkage for any code that will be called by
C.

John A. Tamplin jat@jaet.org
770/436-5387 HOME 4116 Manson Ave
770/431-9459 FAX Smyrna, GA  30082-3723



Message has 1 Reply:
  Re: thread class for legOS
 
(...) In the post you replied to saying "static doesn't matter", the proposal was: private: static int runWrapper(...) ; I then replied to your post, etc. Anyway, let's not degenerate into he-said-she-said. We're really just talking past each other (...) (22 years ago, 22-Jan-02, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: thread class for legOS
 
(...) Static DOES matter; it declares the method as being a "class" method, rather than a normal instance method. I believe there is no implicit 'this' parameter and therefore it can be treated like a normal function. Of course, it can't be linked (...) (22 years ago, 21-Jan-02, to lugnet.robotics.rcx.legos)

8 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR