Skip to content

sammijss/tech-talk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

tech-talk

Tech talk presentation to colleague.

Topic: assert()

Header file: #include<assert.h>

Declaration: void assert(int expression);

Behaviour: If the expression evaluates to TRUE, then assert() does nothing. If the expression evaluates to FALSE, then assert() displays an error message on stderr and aborts the program execution.

Advantages:

1- We will get the more descriptive message on standard error: Assertion failed: expression, file filename, line line number

2- We can disable the assert() calls through the program to make it faster. g++ -DNDEBUG test.cpp

But these are the validation at runtime.

So, how we can do the validation on runtime. We can std::static_assert() to achive compile time validation.

About

Tech talk presentation to colleague.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages