Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert some macros into inline functions #2

Open
schwern opened this issue Jan 1, 2014 · 0 comments
Open

Convert some macros into inline functions #2

schwern opened this issue Jan 1, 2014 · 0 comments

Comments

@schwern
Copy link
Contributor

schwern commented Jan 1, 2014

The code is difficult to debug and understand due to the heavy use of macros. I also suspect the code would be smaller and the C compiler would have an easier time optimizing inline functions.

Choose a macro that should be a function and turn it into an inline function. Follow the C99 conventions for inline functions, perl5ic compiles as C99 now.

Don't worry if this is a good idea or not, just do it. Use the inline branch.

Make sure not to break backwards compatibility. For example, some of these macros are genuine C idioms, like having a macro to do an otherwise complex assignment such as AvARRAY(av) = foo. Leave them be. A lot of macros aren't published in the API but are still used. Rather than changing the name or behavior of a macro, make a new name for the inline function.

schwern pushed a commit that referenced this issue Nov 13, 2014
Date: Fri, 16 Aug 2013 08:59:49 -0400
Message-ID: <[email protected]>

(Amended by the committer to preserve local changes in 07locale.t from
3fca3d6 (the first part of hunk #2 is not
in 0.9903) and 02aba72 (not in 0.9903 at
all), and to fix a "tab after spaces" problem in version.pm. These changes
are being sent back upstream in CPAN RT#87513.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant