|
Last change
on this file since 1648 was 1456, checked in by bird, 21 years ago |
|
...
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | /* $Id: namelessunions.c 1456 2004-09-05 10:17:06Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | *
|
|---|
| 4 | * Testcase for nameless unions.
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of InnoTek LIBC.
|
|---|
| 10 | *
|
|---|
| 11 | * InnoTek LIBC is free software; you can redistribute it and/or modify
|
|---|
| 12 | * it under the terms of the GNU General Public License as published by
|
|---|
| 13 | * the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | * (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * InnoTek LIBC is distributed in the hope that it will be useful,
|
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | * GNU General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU General Public License
|
|---|
| 22 | * along with InnoTek LIBC; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | struct bar
|
|---|
| 28 | {
|
|---|
| 29 | short s1;
|
|---|
| 30 | char ch1;
|
|---|
| 31 | short s2;
|
|---|
| 32 | char ch2;
|
|---|
| 33 | short s3;
|
|---|
| 34 | char ch3;
|
|---|
| 35 | };
|
|---|
| 36 |
|
|---|
| 37 | struct foo
|
|---|
| 38 | {
|
|---|
| 39 | int i1;
|
|---|
| 40 | union
|
|---|
| 41 | {
|
|---|
| 42 | char ach[20];
|
|---|
| 43 | struct bar s;
|
|---|
| 44 | };
|
|---|
| 45 | void *pv;
|
|---|
| 46 | };
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | struct foo gFoo;
|
|---|
| 50 | struct foo *gpFoo = &gFoo;
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 | int main()
|
|---|
| 54 | {
|
|---|
| 55 | return gpFoo->i1;
|
|---|
| 56 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.