- skipping spaces in a sprintf format - 1 Update
- Trying to manipulate dynamic_cast - 2 Updates
| "Öö Tiib" <ootiib@hot.ee>: Oct 31 06:33AM -0700 On Sunday, 30 October 2022 at 00:03:59 UTC+3, Michael S wrote: > class, which I consider the only good part of otherwise awful C++ > "native" I/O classes with such obviously well-designed thing as > printf-style formatting looks to me as very promising. My experiments with boost::format were brief. Its downsides for me were weird % delimited/chained syntax, yet another kind of format specifiers and performance seemed among worst of alternatives. Its upsides were that it was type safe and that it supported positional specifiers (kind of like printfs that are overridden by gettext support of positional specifiers). The compilers are warning about type mismatches in printf arguments and positional specifiers are only ever used for i18n. I18n implies UTF-8 and support of actual tools for human translators. What tool supports and integrates with boost::format? Without it ... it is major pain to even reach agreement with any translation company so those upsides left me indifferent. > C++20 has something similar (std::format), but for my personal taste > it is too new and unproven. And different from C tradition for no obvious benefit. Agreed. The <format> has all the very same issues that <regex> has. It mentions supporting UTF-8 exactly zero times, has yet another "innovative" specifiers no tool supports, has no improvements (like say those positional specifiers) and so who needs it? For what? |
| Juha Nieminen <nospam@thanks.invalid>: Oct 31 07:29AM > I intend to manipulate the functionality of 'dynamic_cast' on x86_64 with the GNU compiler 'g++'. dynamic_cast is a rather complicated feature. Most C++ programmers think of it as "just a downcast with a check to see that the current object is actually of the derived type we are casting to". However, it supports more than just casting from a base class type to a derived class type with a validity check. You can have a very complicated diamond inheritance scenario involving a dozen classes up and down the inheritance tree (and even multiple diamond shapes within this tree), and you can dynamic_cast between any two class types within that tree, and it will work (ie. it will check if the object in question actually is of, or inherits from, the target class type, and correctly calculates the pointer offset for that particular type within the current object, no matter where in the complex diamond inheritance hierarcy the source and target types may be.) And yes, this does involve traveling inheritance hierarchies up and down (possibly with some optimizations). |
| Juha Nieminen <nospam@thanks.invalid>: Oct 31 07:38AM > You can have a very complicated > diamond inheritance scenario involving a dozen classes up and down the > inheritance tree Correction: Diamond inheritance, or even just multiple inheritance without any diamonds. dynamic_cast will work correctly even if the source and target class types have no common base class at all. (If there's a class that inherits from both classes, directly or through a longer chain of inheritances, dynamic_cast will find out if this is such an object, even if the compiler does not see nor know about that class that inherits from both at the point where you do the dynamic_cast.) |
| You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment