hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[SUGGESTION] Option to disable UFCS

MaxSagebaum opened this issue · comments

As shown in the comment #904 (comment) UFCS macro/template can have a real impact on compile times. Also, it improved with the later patches, the error messages a some times quite problematic.

name compile compile adjusted compile relative
base_03_cpp2_struct-compile 14.14 0 0
cleanup_00_base-compile 25.48 11.35 1
cleanup_01_remove_UFCS-compile 19.49 5.36 0.47

Therefore I would like to start a discussion about options to disable UFCS for some code parts and maybe for other safety features as well.

  • What do you think about the general idea?
  • One idea of mine would be to use metafunctions to change the state of the cppfront compiler. e.g.
test: @UFCS_NO namespace = {
// UFCS disabled for the namespace
 func: () = {
   @UFCS_YES {
      // UFCS enabled in this scope.
   }
 }
}
  • A different function call operator? E.g. obj.func(! a, b) or func2(! a, b). So the (! operator disables UFCS. ( I used (! because I have no better idea.)
  • The same technique could be used to disable e.g. bounds checking in loops.

What are your thoughts?

possibly duplicate of #1004

Yes, sorry forgot to search.