[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: constructor vs. __constructor__
From: |
Peter Maydell |
Subject: |
Re: constructor vs. __constructor__ |
Date: |
Thu, 24 Aug 2023 10:33:20 +0100 |
On Thu, 24 Aug 2023 at 06:55, Markus Armbruster <armbru@redhat.com> wrote:
>
> Liu Jaloo <liu.jaloo@gmail.com> writes:
>
> > What's the difference between "__attribute__((constructor))" and
> > "__attribute__((__constructor__))" in qemu source?
>
> Reading the fine manual helps:
>
> You may optionally specify attribute names with ‘__’ preceding and
> following the name. This allows you to use them in header files
> without being concerned about a possible macro of the same name. For
> example, you may use the attribute name __noreturn__ instead of
> noreturn.
As usual in the QEMU sources, we are not particularly consistent
about using one version compared to the other. However we
mostly use the "__attribute__((foo))" form rather than
"__attribute__((__foo__))" so if you're writing new code then
prefer the former.
We also have a handful of uses of "__attribute((foo))" and
"__attribute((__foo__))". Definitely don't add more of those :-)
thanks
-- PMM