Comments (2)
as for the original version, however, the compiler may fold the constant in most cases, but this one it more straight forward.
from stanford-cpp-library.
After investigation, I found that there is some problems with my code at gcc -O0
:
mine:
unsigned long array_length<int, 5ul>(int (&) [5ul]):
push rbp
mov rbp, rsp
mov QWORD PTR [rbp-8], rdi
mov eax, 5
pop rbp
ret
main:
push rbp
mov rbp, rsp
sub rsp, 32
lea rax, [rbp-32]
mov rdi, rax
call unsigned long array_length<int, 5ul>(int (&) [5ul])
leave
ret
original:
main:
push rbp
mov rbp, rsp
mov eax, 5
pop rbp
ret
The results are the same at -O1
and above. Hence, I guess there is no need to use template here. Sorry for open this issue before looking into it deeper.
from stanford-cpp-library.
Related Issues (20)
- Use Stanford c++ library into cmakelist.txt HOT 2
- Is JBEConsole.java open sourced? HOT 1
- GRect overrides final method `paint` and `scale` HOT 1
- Autograder timeout when student thread is drawing bad news HOT 1
- Autograder timeout inside runAndCapture leaves streams in bad state HOT 2
- Quite a lot undefined behaviors HOT 1
- Try avoiding unnecessary copy constructions
- close console window doesn't make it clear when it interrupting running main
- `Grid<T>::locations()` appears nonempty for 0 x m and n x 0 grids. HOT 1
- Trigger cleaner `static_assert` errors for missing comparison operators
- Errors on macOS font loading HOT 2
- errors when building the project: can not create files or directories
- Inconsistency between `readEntireFile` overloads and `readEntireStream` overloads. HOT 3
- Add default constructor to `GRectangle` HOT 1
- Scaled `GImage` uses transformed coordinate system for rendering, rather than global coordinate system
- Unexpected behavior of `const` overload of `Map::operator[]`
- Add `operator+` overload for `T` and `Vector<T>` HOT 2
- SPL pretty printers for QT debugger HOT 2
- Add SFINAE overloading to `Set` and `HashSet` constructor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stanford-cpp-library.