Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: Problem with function pointers and structures

Reply
Thread Tools

Re: Problem with function pointers and structures

 
 
Eric Sosman
Guest
Posts: n/a
 
      07-02-2009
Simon Connah wrote:
> On 2009-07-02 20:39:54 +0100, Simon Connah <(E-Mail Removed)>
> said:
>
>> typedef struct user
>> {
>> char *username;
>> char *password;
>>
>> /* lots more... omitted for brevity */
>>
>> struct user *interface;
>> }

>
> Oops this should read:
>
> typedef struct user
> {
> char *username;
> char *password;
>
> /* lots more... omitted for brevity */
>
> struct user *interface;
> } user;


ITYM it should read

typedef struct user {
/* omitted for brevity */
user_interface *interface;
} user;

.... on the assumption that eventually you'll do things like

PGconn conn = ...;
user *ptr = ...;
ptr->interface->add(&conn, ptr);

See also "Poor Man's Object-Oriented C."

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)lid
 
Reply With Quote
 
 
 
 
luserXtrog
Guest
Posts: n/a
 
      07-04-2009
On Jul 2, 3:33*pm, Eric Sosman <(E-Mail Removed)> wrote:

<snipperoo!>

> See also "Poor Man's Object-Oriented C."


I'm not finding anything by that name. Is this the precise title?

--
lxt
 
Reply With Quote
 
 
 
 
Nobody
Guest
Posts: n/a
 
      07-04-2009
On Fri, 03 Jul 2009 22:26:46 -0700, luserXtrog wrote:

>> See also "Poor Man's Object-Oriented C."

>
> I'm not finding anything by that name. Is this the precise title?


I don't think that he meant the "see also" literally.

 
Reply With Quote
 
Eric Sosman
Guest
Posts: n/a
 
      07-04-2009
luserXtrog wrote:
> On Jul 2, 3:33 pm, Eric Sosman <(E-Mail Removed)> wrote:
>
> <snipperoo!>
>
>> See also "Poor Man's Object-Oriented C."

>
> I'm not finding anything by that name. Is this the precise title?


No; fuzzy searching is called for. That was the phrase I
recall hearing back in the days when C++ was only spottily
available and when every system that had C++ had its very own
dialect (and when I worked on a 2.7Mloc O-O C program).

--
Eric Sosman
(E-Mail Removed)lid
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pointers, pointers, pointers... cerr C Programming 12 04-07-2011 11:17 PM
Re: Problem with function pointers and structures jameskuyper C Programming 2 07-09-2009 04:25 PM
Re: Problem with function pointers and structures Jens Thoms Toerring C Programming 7 07-04-2009 01:02 PM
structures, structures and more structures (questions about nestedstructures) Alfonso Morra C Programming 11 09-24-2005 07:42 PM
Type Casting IPv4 and IPv6 structures to Generic Structures tweak C Programming 14 06-11-2004 02:43 PM



Advertisments