Skip to content

Commit

Permalink
Move exception handling example into own directory
Browse files Browse the repository at this point in the history
  • Loading branch information
gjbex committed Mar 6, 2024
1 parent e766d9c commit 349fc7b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
9 changes: 9 additions & 0 deletions source-code/ErrorHandling/Exceptions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.20)

project(exceptions LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

add_executable(fac.exe fac.cpp)
10 changes: 10 additions & 0 deletions source-code/ErrorHandling/Exceptions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Expected

Illustrates how to use exceptoin to do error handling.

## What is it?

1. `fac.cpp`: C++ application that reads an argument from the command line,
validates the value, computes the factorial and displays the output or
the error message.
1. `CMakeLists.txt`: CMake file to build the applications.
File renamed without changes.
15 changes: 0 additions & 15 deletions source-code/ErrorHandling/Makefile

This file was deleted.

5 changes: 2 additions & 3 deletions source-code/ErrorHandling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Code illustrations for chapter 3, Modularity in Stroustrup's
"A tour of C++" on error handling using exceptions.

# What is it?
1. `fac.cpp`: illustrates exception handling.
1. `Makefile`: make file for these examples.
1. `Expected`: illustrates error handling using `std::expected`.
1. `Exceptions`: illustration of error handling with exceptions.
1. `MemoryLeak`: illustrates how inappropriately handled exceptions can
lead to memory leaks, and how to fix that.
1. `Expected`: illustrates error handling using `std::expected`.

0 comments on commit 349fc7b

Please sign in to comment.