Skip to content

Commit

Permalink
add c++
Browse files Browse the repository at this point in the history
  • Loading branch information
acheronfail committed Dec 23, 2023
1 parent fae1c62 commit fae1a69
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ jobs:
build:
- assembly
- bun
- clang
- c-gcc
- c-clang
- cpp-gcc
- cpp-clang
- cobol
- coffeescript
- crystal
- deno
- erlang
- fortran
- gcc
- go
- haskell
- java
Expand Down
12 changes: 12 additions & 0 deletions count.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <iostream>
#include <cstdlib>

int main(int argc, char *argv[]) {
int i = 0;
int target = std::atoi(argv[1]);
while(i < target) {
i = (i + 1) | 1;
}
std::cout << i << std::endl;
return 0;
}
12 changes: 10 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,22 @@ summary results:

# languages

build-gcc: (_check "gcc")
build-c-gcc: (_check "gcc")
gcc -O3 ./count.c
echo './a.out {{i}}' > CMD

build-clang: (_check "clang")
build-c-clang: (_check "clang")
clang -O3 ./count.c
echo './a.out {{i}}' > CMD

build-cpp-gcc: (_check "g++")
g++ -O3 ./count.cpp
echo './a.out {{i}}' > CMD

build-cpp-clang: (_check "clang++")
clang++ -O3 ./count.cpp
echo './a.out {{i}}' > CMD

build-rust: (_check "rustc")
rustc -C opt-level=3 ./count.rs
echo './count {{i}}' > CMD
Expand Down

0 comments on commit fae1a69

Please sign in to comment.