Giter VIP home page Giter VIP logo

lewg's People

Contributors

brycelelbach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lewg's Issues

Set up a real issue tracker for LEWG

I'm leaning toward a bugzilla on isocpp.org, but a copy of the LWG's issues software will work if that doesn't.

Until then, I'm recording issues here so we don't lose them.

Provide a function to compute x mod 2**n

Recorded from c++std-lib-ext-655, from Herb Sutter:

Hans Boehm:

Which, like the status quo, leaves us with no efficient way to express the
mathematical version of X mod 2**n (which doesn't yield negative values),
in spite of the fact that the hardware can easily do it in one instruction?

Richard Smith:

Excuse my ignorance, but what's wrong with "unsigned(X) & (1u << n)" (for
n <= sizeof(int) * CHAR_BIT)?

Jens Maurer:

Indeed, 4.7p2 says "(unsigned)X" does the right thing even for negative X.

Assuming this is correct, the above six lines seems like ample motivation for a std::mod2 function... Standardization is (among other things) for common operations that (a) will be duplicated by many programmers, and/or (b) are so subtle that programmers won't readily get them right. If someone named Hans Boehm is both stating it's frequently needed and is asking how to implement it, I presume that's enough evidence for both criteria and we should add std::mod2 with the above semantics?

Initial proposed resolution:

In [??.??], add the following new subclause:

[??.??] Modulo 2 operations [??.??]

int mod2(int val, int n);
unsigned mod2(unsigned val, int n);
long mod2(long val, int n);
unsigned long mod2(unsigned long val, int n);
long long mod2(long long val, int n);
unsigned long long mod2(unsigned long long val, int n);

1 Requires: n <= sizeof(val) * CHAR_BIT.
2 Returns: UTYPE(X) & ((UTYPE(1) << n) - 1), where for each function UTYPE is the unsigned type of the same size as val.

Some guidelines seem out of date

The design guideline recommend to use C++03 syntax over C++11 features.

Where C++ 2003 syntax can be used, that is preferred over C++ 2011 features.

It is not clear to me what that mean exactly, and it seems to be there are benefits to use the latest published standard in the specification whenever beneficial and relevant. Which I think we do, so that guideline may no longer apply?

Other things that seems need changing:

  • Use SFINAE to constrain templates:

It's implementation defined how templates are constrained, and concepts should probably be otherwise preferred?

  • Operators come in groups: (==, !=), (<, >, <=, >=)

Maybe we should prefer <=> whenever applicable

  • Don't use code to specify behavior.

I think we do, sometimes

  • For templates, make it clear what the concepts are.

Should we not prefer exposition-only concepts where applicable?

  • Use clause [structure.specifications] to determine what specification clauses to use.

Might be interesting to mention P1369

  • Do not use requires clauses or define new language-level concepts until the introduction (section 6) and fundamental concepts (section 7) from the Ranges TS have merged into the IS.

Time to revisit that ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.