All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Markus Rathgeb <maggu2810@googlemail.com>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>,
	Patrick Ohly <patrick.ohly@intel.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] bluetooth.h: fix compile issue when using in C++
Date: Thu, 08 Mar 2012 09:51:17 -0800	[thread overview]
Message-ID: <1331229077.14217.9.camel@aeonflux> (raw)
In-Reply-To: <CAOcK=CO9au1DnBCw-9bik+nnuOdptNVBpStRVWjdOUaj55xHHg@mail.gmail.com>

Hi Markus,

please do not top post on this mailing list.

> Why can't we get rid off the "typeof" keyword completely and using a
> template similar approach:
> 
> ===
> 
> #define bt_get_unaligned_tmpl(type, ptr)         \
> ({                                               \
>        struct __p_s  {                           \
>                type __v;                         \
>        } __attribute__((packed));                \
>        struct __p_s *__p = (struct __p_s*)(ptr); \
>        __p->__v;                                 \
> })
> 
> static inline uint64_t bt_get_le64(void *ptr)
> {
> 	return bt_get_unaligned_tmpl(uint64_t, ptr);
> }
> 
> static inline uint64_t bt_get_be64(void *ptr)
> {
> 	return bswap_64(bt_get_unaligned_tmpl(uint64_t, ptr));
> }
> 
> ===
> 
> Okay, the macro parameter type is not encapsulated by parenthesis, but
> it seems okay and working.
> So it seems to be a very more portable solution (IMHO).

what does seems okay and working actually mean? Have you actually
verified on platform that require correct unaligned access to data?

Regards

Marcel



  reply	other threads:[~2012-03-08 17:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 10:11 [PATCH] bluetooth.h: fix compile issue when using in C++ Patrick Ohly
2012-03-04 23:27 ` Marcel Holtmann
2012-03-05  7:33   ` Patrick Ohly
     [not found]     ` <CAOcK=CNZofxZtUp4Zh5eiGMM_TYrbGOwseA3tcwAnAFDvLEFxg@mail.gmail.com>
2012-03-05 13:12       ` Patrick Ohly
2012-03-05 14:53         ` Markus Rathgeb
2012-07-27 16:38         ` W. Trevor King
2012-08-17  5:18         ` W. Trevor King
2012-08-27 23:40           ` Johan Hedberg
2012-09-05 17:27             ` Pacho Ramos
2012-09-05 17:56               ` Pacho Ramos
2012-03-05 20:06   ` Lucas De Marchi
2012-03-08 13:22     ` Markus Rathgeb
2012-03-08 17:51       ` Marcel Holtmann [this message]
2012-03-08 20:59         ` Markus Rathgeb
2012-03-09 10:52           ` Markus Rathgeb
2012-03-03 17:15 Markus Rathgeb
2012-07-29  7:52 Pacho Ramos
2012-08-01 14:41 ` Pacho Ramos

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=1331229077.14217.9.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=lucas.demarchi@profusion.mobi \
    --cc=maggu2810@googlemail.com \
    --cc=patrick.ohly@intel.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.