Skip to content

Instantly share code, notes, and snippets.

@yohhoy
Created December 4, 2016 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yohhoy/ccade95cdbb345611bce8dcfc20847e7 to your computer and use it in GitHub Desktop.
Save yohhoy/ccade95cdbb345611bce8dcfc20847e7 to your computer and use it in GitHub Desktop.
gcc 7.0(HEAD) -std=c++1z -03
#include <cstdio>
#include <string>
int main() {
using namespace std::literals::string_view_literals;
for (char c: "Hello"sv) {
std::printf("(%d)", c);
}
}
.LC0:
.string "Hello"
.LC1:
.string "(%d)"
main:
pushq %rbp
pushq %rbx
movl $.LC0+5, %ebp
movl $.LC0, %ebx
subq $8, %rsp
.L2:
movsbl (%rbx), %esi
xorl %eax, %eax
movl $.LC1, %edi
addq $1, %rbx
call printf
cmpq %rbx, %rbp
jne .L2
addq $8, %rsp
xorl %eax, %eax
popq %rbx
popq %rbp
ret
@yohhoy
Copy link
Author

yohhoy commented Dec 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment