www.delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
Sender: | cygwin-owner AT sourceware DOT cygnus DOT com |
Delivered-To: | mailing list cygwin AT sourceware DOT cygnus DOT com |
Message-ID: | <0bcd01bea76c$5afc8e00$e63d2509@jonpryor.raleigh.ibm.com> |
From: | "Jonathan Pryor" <jonpryor AT vt DOT edu> |
To: | "pbecker" <pbecker AT idirect DOT com>, |
"Cygwin Sourceware" <cygwin AT sourceware DOT cygnus DOT com> | |
Subject: | Re: Newbie question about structures and further documentation |
Date: | Wed, 26 May 1999 07:38:24 -0400 |
MIME-Version: | 1.0 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook Express 4.72.3110.5 |
X-Mimeole: | Produced By Microsoft MimeOLE V4.72.3110.3 |
Posting sample code that you're having problems with would help. However, I'm able to pass and return an entire structure on the stack. /* st.c -- passing around structs. * to compile: gcc -o st st.c */ #include <stdio.h> struct foo { int bar; }; void by_value (struct foo f) { printf ("value of foo::bar: %i\n", f.bar); } void by_ptr (struct foo* pf) { printf ("value of foo::bar: %i\n", pf->bar ); } struct foo ret_foo () { struct foo f; f.bar = 42; return f; } int main () { struct foo f; f = ret_foo (); by_value (f); by_ptr(&f); return 0; } hth - Jon -----Original Message----- From: pbecker <pbecker AT idirect DOT com> To: Cygwin Sourceware <cygwin AT sourceware DOT cygnus DOT com> Date: Wednesday, May 26, 1999 2:51 AM Subject: Newbie question about structures and further documentation >I am a student at the DeVry Institute of Tech. I am just learning the >C language. The compile of choice at school is Borland. This is not my >choice. I prefer to use Cygwin and my Emacs editor. > >I have become aware of some incompatibilities between the two >compilers. Problems, which my teacher cannot help me with because he >is not familiar with this compiler. > >With regards to structures, my text book states that some compilers >cannot pass and return entire structures to a function. I seem to be >unable to do this either. I seem to be unable to even pass a pointer >to a struct. > >How does Cygwin deal with this differently? Where can I find docs that >would be appropriate for someone like myself? I have been unable to >extract any useful information from the documentation at the Cygwin >site. > >Paul Becker > > >-- >Want to unsubscribe from this list? >Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com > -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |