Live data from Hacker News

Compile time regular expression in C++

github.com

1–10 of 30 posts

Re: Compile time regular expression in C++

#5
post #3
post #2

Hopefully the standard regex will be constexpr soon.

Not to mention, like... trig functions. I know std::cos et al. need to set errno. Maybe cppfront will get rid of it.

Compile with -fno-math-errno. Almost nobody checks errno for math functions, and disabling it can give a huge speedup.

Re: Compile time regular expression in C++

#6
post #5
post #3

Earlier quoted context omitted.

Not to mention, like... trig functions. I know std::cos et al. need to set errno. Maybe cppfront will get rid of it.

Compile with -fno-math-errno. Almost nobody checks errno for math functions, and disabling it can give a huge speedup.

That sets the cmath functions constexpr??

Re: Compile time regular expression in C++

#8
I'd love for someone to add this to rebar[1] so that we can get a good sense of how well it does against other general purpose regex engines. It will be a little tricky to add (since the build step will require emitting a C++ program and compiling it), but it should be possible.

[1]: https://github.com/BurntSushi/rebar

Re: Compile time regular expression in C++

#9
post #3
post #2

Hopefully the standard regex will be constexpr soon.

Not to mention, like... trig functions. I know std::cos et al. need to set errno. Maybe cppfront will get rid of it.

Isn’t the issue with functions like this that they are not guaranteed to be the same on all hardware? So making it constexpr could break programs or cause the constexpr evaluated result to differ from the runtime result even for the same inputs

Re: Compile time regular expression in C++

#10
post #3
post #2

Hopefully the standard regex will be constexpr soon.

Not to mention, like... trig functions. I know std::cos et al. need to set errno. Maybe cppfront will get rid of it.

What does cppfront have to do with it? You can write/download/import/enable constexpr implementations of cos with standard c++ compilers?

That’s like saying you can’t drive during winter with your car because it came with summer tires... just change your tires?

Post reply on HN