From: Led <ledest@gmail.com>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] union in C99
Date: Tue, 23 Sep 2008 21:32:39 +0300
Message-ID: <200809232132.40096.ledest@gmail.com> (raw)
In-Reply-To: <20080923182245.GA11804@localhost.localdomain>
On Tuesday, 23 September 2008 21:22:47 Kirill A. Shutemov wrote:
> On Tue, Sep 23, 2008 at 07:22:41PM +0300, Led wrote:
> > потребовалось сделать что-то типа такого:
> > - int i_bframe_adaptive;
> > + union {
> > + int i_bframe_adaptive;
> > + int b_bframe_adaptive __attribute__((__deprecated__));
> > + };
> >
> > это поля structx 264_param_t . Но при -std=c99 получаем:
> > libx264.c:165: error: 'x264_param_t' has no member named
> > 'i_bframe_adaptive'
> >
> > Как это сейчас правильно реализуется?
>
> Как вариант, можно попробовать что-то типа такого:
>
> - int i_bframe_adaptive;
> +#define i_bframe_adaptive bframe_adaptive.i
> +#define i_bframe_adaptive bframe_adaptive.b
> + union {
> + int i;
> + int b __attribute__((__deprecated__));
> + } bframe_adaptive;
Спасибо. Да, такой вариант я тоже рассматривал, но с define'ами не очень
красиво получается - в этом случае будет тупо подменяться все
i_bframe_adaptive/b_bframe_adaptive, даже если это не поля структуры
x264_param_t. Пока остановился на варианте:
+#ifdef __GNUC__
+ __extension__ union {
+ int i_bframe_adaptive;
+ int b_bframe_adaptive __attribute__((__deprecated__));
+ };
+#else
int i_bframe_adaptive;
+#endif
--
Led
prev parent reply other threads:[~2008-09-23 18:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-23 16:22 Led
2008-09-23 16:26 ` Damir Shayhutdinov
2008-09-23 16:37 ` Led
2008-09-23 18:19 ` Led
2008-09-23 18:22 ` Kirill A. Shutemov
2008-09-23 18:32 ` Led [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200809232132.40096.ledest@gmail.com \
--to=ledest@gmail.com \
--cc=devel@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git