FLTK logo

Re: [fltk.coredev] Re: How to test C++98 compatibility?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Re: How to test C++98 compatibility? Albrecht Schlosser 05:18 May 10  
 
On 5/10/23 10:30 imacarthur wrote:
On Wednesday, 10 May 2023 at 09:06:57 UTC+1 Matt wrote:
Albrecht Schlosser schrieb am Dienstag, 9. Mai 2023 um 21:33:16 UTC+2:
On 5/8/23 15:58 'melcher...' via fltk.coredev wrote:
I can of course rewrite this to use a trailing number for number of arguments... : `FL_FUNCTION_CALLBACK_3(btn, something, int, a, 3, int, b, 4, int, c, 5)`
This would be an interesting change because it would make sure that you assign the correct number of arguments (triplets) for every macro. Should be considered, IMHO. Even better if it also increases compatibility...

Unfortunately we can't have it both. The compiler throws an error es soon as it sees the ellipsis (...).

I didn't suggest to have both versions. My thoughts were about **changing** the macros to ones with '_n' that represents the number of callback function arguments so the user can get feedback if they are using the wrong number of macro arguments (e.g. missing one part of a triplet, etc.).

But I could disable the varargs version if fl_attr.h determines a really old compiler.

No, please don't do that. It would make user code that works on newer compilers fail on those older compilers anyway. It's better to have only one macro implementation for clarity.

FWIW, I'm inclined towards the variadic macro solution.

Hmm, why? Just for my curiosity.

Anyway, I'm not against it, I could live with both a variadic and a "counted arguments" version. But I also see that the variadic macro solution would be more elegant.

Maybe, as Albrecht suggested earlier, we can include something in the docs. to the effect of "If you are using an older compiler that does not support variadic macros, this feature will not be available, so in that case do not use it!"

I'd assume anyone choosing to use an old compiler toolchain is doing so for a reason, probably knows what they are doing, and may well be running on ancient hardware that has limited capabilities anyway...

Yep, I agree.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/f5aeac0c-43f9-7d73-9983-7ed9fc586f43%40online.de.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.