From fddc7e51adaf5ad3c9282cb094bbc07616c88b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Fri, 6 May 2022 11:29:09 +0200 Subject: [PATCH] Add inline function sources. --- 01-inline-functions/inline.cpp | 13 +++++++++++++ 01-inline-functions/no-inline.cpp | 13 +++++++++++++ Makefile | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 01-inline-functions/inline.cpp create mode 100644 01-inline-functions/no-inline.cpp diff --git a/01-inline-functions/inline.cpp b/01-inline-functions/inline.cpp new file mode 100644 index 0000000..2406686 --- /dev/null +++ b/01-inline-functions/inline.cpp @@ -0,0 +1,13 @@ +#include +#include + +inline void print_prog(char *prog_name) +{ + std::cout << "Program name: " << prog_name << std::endl; +} + +int main(int argc, char *argv[]) +{ + print_prog(argv[0]); + return EXIT_SUCCESS; +} diff --git a/01-inline-functions/no-inline.cpp b/01-inline-functions/no-inline.cpp new file mode 100644 index 0000000..ea3cec1 --- /dev/null +++ b/01-inline-functions/no-inline.cpp @@ -0,0 +1,13 @@ +#include +#include + +void print_prog(char *prog_name) +{ + std::cout << "Program name: " << prog_name << std::endl; +} + +int main(int argc, char *argv[]) +{ + print_prog(argv[0]); + return EXIT_SUCCESS; +} diff --git a/Makefile b/Makefile index cbff4b9..c10fe78 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CPP=g++ -EXEC := 00-const-vars/const.exe 00-const-vars/no-const.exe +EXEC := 00-const-vars/const.exe 00-const-vars/no-const.exe 01-inline-functions/inline.exe 01-inline-functions/no-inline.exe all: $(EXEC)