From af17057076193a1a1d64b5c4ffa75269a4525a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Mon, 23 May 2022 11:47:04 +0200 Subject: [PATCH] Finished inline files. --- 01-inline-functions/inline.cpp | 9 ++++----- 01-inline-functions/no-inline.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/01-inline-functions/inline.cpp b/01-inline-functions/inline.cpp index 2406686..cfba2f9 100644 --- a/01-inline-functions/inline.cpp +++ b/01-inline-functions/inline.cpp @@ -1,13 +1,12 @@ #include -#include -inline void print_prog(char *prog_name) +inline int __attribute__((always_inline)) sum(int a, int b) { - std::cout << "Program name: " << prog_name << std::endl; + return a + b; } -int main(int argc, char *argv[]) +int main() { - print_prog(argv[0]); + int aux = sum(7,9); return EXIT_SUCCESS; } diff --git a/01-inline-functions/no-inline.cpp b/01-inline-functions/no-inline.cpp index ea3cec1..336bb2e 100644 --- a/01-inline-functions/no-inline.cpp +++ b/01-inline-functions/no-inline.cpp @@ -1,13 +1,12 @@ #include -#include -void print_prog(char *prog_name) +int sum(int a, int b) { - std::cout << "Program name: " << prog_name << std::endl; + return a + b; } -int main(int argc, char *argv[]) +int main() { - print_prog(argv[0]); + int aux = sum(7,9); return EXIT_SUCCESS; }