[PATCH] D29161: [APFloat] Reduce some dispatch boilerplates. NFC.

Eric Christopher via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 10:41:00 PST 2017


echristo added inline comments.


================
Comment at: llvm/include/llvm/ADT/APFloat.h:24
 
+#define APFLOAT_SINGLE_DISPATCH(METHOD_CALL)                                   \
+  do {                                                                         \
----------------
timshen wrote:
> echristo wrote:
> > timshen wrote:
> > > jlebar wrote:
> > > > echristo wrote:
> > > > > jlebar wrote:
> > > > > > What does "single" refer to here?
> > > > > > 
> > > > > > APFLOAT_SEMANTIC_DISPATCH?  I don't really like that either.
> > > > > > 
> > > > > > Maybe someone else has a better suggestion.
> > > > > APFLOAT_FORMAT_DISPATCH ?
> > > > I like that one.
> > > For single dispatch, see https://en.m.wikipedia.org/wiki/Dynamic_dispatch#Single_and_multiple_dispatch .
> > > 
> > > Here the macro expands to code that dispatches on "*this" APFloat object. This isn't the case for add or convert.
> > Most people will read the macro as a "what are we doing" rather than "how are we doing it" I think which is why I suggested format.
> I actually don't know what "format" means here. How about APFLOAT_DISPATCH? :)
You could also use layout dispatch. The idea is the "format" of the float. I just don't like layout, but that's also fine if you'd prefer it.


https://reviews.llvm.org/D29161





More information about the llvm-commits mailing list