SlideShare ist ein Scribd-Unternehmen logo
1 von 39
1
C best and worst practices
Andrew Lukin
2019, Kharkiv
2
“Only two things are infinite, the
universe and human stupidity, and
I'm not sure about the former.”
Attributed to Albert Einstein
3
Some obscure moments: ternary operator
4
Some obscure moments: ternary operator
x ? : y
from Android’s QEMU:
machine->max_cpus = machine->max_cpus ?: 1; /*
Default to UP */
https://android.googlesource.com/platform/external
/qemu/+/master/vl-android.c#3472
5
Some obscure moments: ternary operator
x ? x : y
6
Some obscure moments: ternary operator
x ? x : y
It’s ok when 1st operand contain a side effect
but with -pedantic you’ll have the following complaints from
compiler:
warning: ISO C forbids omitting the middle term of a ?:
expression
7
Some obscure moments: ternary operator
status_color = frobs < 10 ? CODE_GREEN : frobs <
15 ? CODE_YELLOW : frobs < 20 ? CODE_RED :
CODE_PURPLE;
Is it clear?
8
Some obscure moments: ternary operator
status_color = frobs < 10 ? CODE_GREEN
: frobs < 15 ? CODE_YELLOW
: frobs < 20 ? CODE_RED
: CODE_PURPLE;
At least format it like that
9
A bit more of potential mistakes
from some real driver:
if(strlen(ops->name)) {
strncpy(n->name, ops->name,
(strlen(ops->name) > 79)?79:strlen(ops->name)
);
}
10
A bit more of potential mistakes
from some real driver:
if(strlen(ops->name)) {
strncpy(n->name, ops->name,
(strlen(ops->name) > 79)?79:strlen(ops->name)
);
}
--> use strscpy(), for instance
11
Let’s remember your interview for C position
void (* signal(int __sig, void (* __func)(int))) (int)
12
Let’s remember your interview for C position
void (* signal(int __sig, void (* __func)(int))) (int)
Yes, you are right. This is from some old libc…
And can be found even now, for instance, in Microchip
sources
13
Let’s remember your interview for C position
void (* signal(int __sig, void (* __func)(int))) (int)
Uncovering the magic
14
Let’s remember your interview for C position
void (* signal(int __sig, void (* __func)(int))) (int)
Uncovering the magic
15
Let’s remember your interview for C position
void (* signal(int __sig, void (* __func)(int))) (int)
Uncovering the magic
16
Let’s remember your interview for C position
void (* signal(int __sig, void (* __func)(int))) (int)
Uncovering the magic
17
Let’s remember your interview for C position
void (* signal(int __sig, void (* __func)(int))) (int)
Uncovering the magic
18
Let’s remember your interview for C position
/* Type of a signal handler. */
typedef void (*__sighandler_t) (int);
...
extern __sighandler_t __sysv_signal (int __sig,
__sighandler_t __handler)
__THROW;
glibc developers were wise from the very beginning!
19
Memory?
free(x);
free(x); <-- crash unless you are lucky
20
Memory?
free(x);
x = NULL;
free(x); <-- NO crash
21
--oneline
for(p=0;p+=(a&1)*b,a!=1;a>>=1,b<<=1);
22
--oneline
for(p=0;p+=(a&1)*b,a!=1;a>>=1,b<<=1);
is equal to:
p=0;
while (true) {
p+=(a&1)*b;
if (a == 1) break;
...
a>>=1;
b<<=1;
}
23
Know your language
In some code review
programmer “fixed” long long to long
with comment “Misprint” ...
24
Emoji
:-!!
25
Emoji
:-!!
/* from Linux kernel
*/
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
26
Emoji
:-!!
/* Force a compilation error if condition is true, but also produce a
result (of value 0 and type size_t), so the expression can be used
e.g. in a structure initializer (or where-ever else comma expressions
aren't permitted). */
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
Maybe better to name it ...OR_ZERO()
27
Emoji
28
Best: Use coding standards
A coding standard’s purpose is to restrict use of problematic
areas of the programming language.
29
Best: Use coding standards
A coding standard’s purpose is to restrict use of problematic
areas of the programming language.
So, using coding standards prevents undefined or unspecified
behavior. And it limits the use of error-prone constructs,
such as "goto".
30
Best: Use coding standards
A coding standard’s purpose is to restrict use of problematic
areas of the programming language.
So, using coding standards prevents undefined or unspecified
behavior. And it limits the use of error-prone constructs,
such as "goto".
And using coding standards also improves the code’s
readability, maintainability, and portability. One example is
the use of “typedef” to simplify the syntax of complex
structures.
31
Best: Use coding styles
For instance, Linux kernel coding style
(remember checkpatch.pl)
● indentation
● breaking long lines and strings
● placing braces and spaces
● ...
32
Best: Use coding styles
Or GNU C coding style, for instance:
if (foo)
if (bar)
win ();
else
lose ();
33
Best: Use coding styles
Or GNU C coding style, for instance:
if (foo)
{
if (bar)
win ();
else
lose ();
}
34
Best: Use coding styles
Or GNU C coding style, for instance:
if ((foo = (char *) malloc (sizeof *foo)) == NULL)
fatal ("virtual memory exhausted");
35
Best: Use coding styles
Or GNU C coding style, for instance:
if ((foo = (char *) malloc (sizeof *foo)) == NULL)
fatal ("virtual memory exhausted");
instead, write this:
foo = (char *) malloc (sizeof *foo);
if (foo == NULL)
fatal ("virtual memory exhausted");
36
Best: Use coding styles
Вопрос на форуме:
Уменязапалпробел.Чтомнеделать?
Ответ:
настоящие_программисты_пробелами_не_пользуются
или
НастоящиеПрограммистыПробеламиНеПользуются
37
Lower complexity = Better Code
Write less code go have beer sooner
3838
Questions?
Questions?
39
Questions?
Thank_you!

Weitere ähnliche Inhalte

Was ist angesagt?

printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);Joel Porquet
 
Tecnologi lenguatge
Tecnologi lenguatge Tecnologi lenguatge
Tecnologi lenguatge Ricki Velasco
 
Preprocessor Programming
Preprocessor ProgrammingPreprocessor Programming
Preprocessor Programminglactrious
 

Was ist angesagt? (8)

Test2 Sum05
Test2 Sum05Test2 Sum05
Test2 Sum05
 
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);
 
05 Jo P May 07
05 Jo P May 0705 Jo P May 07
05 Jo P May 07
 
Tecnologi lenguatge
Tecnologi lenguatge Tecnologi lenguatge
Tecnologi lenguatge
 
C programming slide c02
C programming slide c02C programming slide c02
C programming slide c02
 
Preprocessor Programming
Preprocessor ProgrammingPreprocessor Programming
Preprocessor Programming
 
PAL
PALPAL
PAL
 
Function therory
Function theroryFunction therory
Function therory
 

Ähnlich wie C Best and Worst Practices in Embedded

Building reusable libraries
Building reusable librariesBuilding reusable libraries
Building reusable librariesFelix Morgner
 
What has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you developWhat has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you developAndrey Karpov
 
2014-06-26 - A guide to undefined behavior in c and c++
2014-06-26 - A guide to undefined behavior in c and c++2014-06-26 - A guide to undefined behavior in c and c++
2014-06-26 - A guide to undefined behavior in c and c++Chen-Han Hsiao
 
Complete c programming presentation
Complete c programming presentationComplete c programming presentation
Complete c programming presentationnadim akber
 
C++11 and 64-bit Issues
C++11 and 64-bit IssuesC++11 and 64-bit Issues
C++11 and 64-bit IssuesAndrey Karpov
 
(8) cpp abstractions separated_compilation_and_binding_part_i
(8) cpp abstractions separated_compilation_and_binding_part_i(8) cpp abstractions separated_compilation_and_binding_part_i
(8) cpp abstractions separated_compilation_and_binding_part_iNico Ludwig
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programmingNico Ludwig
 
A nice 64-bit error in C
A  nice 64-bit error in CA  nice 64-bit error in C
A nice 64-bit error in CPVS-Studio
 
A Collection of Examples of 64-bit Errors in Real Programs
A Collection of Examples of 64-bit Errors in Real ProgramsA Collection of Examples of 64-bit Errors in Real Programs
A Collection of Examples of 64-bit Errors in Real ProgramsAndrey Karpov
 
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptx
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptxWINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptx
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptxssusercd11c4
 
A Collection of Examples of 64-bit Errors in Real Programs
A Collection of Examples of 64-bit Errors in Real ProgramsA Collection of Examples of 64-bit Errors in Real Programs
A Collection of Examples of 64-bit Errors in Real ProgramsPVS-Studio
 
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!Anne Nicolas
 
Making archive IL2C #6-55 dotnet600 2018
Making archive IL2C #6-55 dotnet600 2018Making archive IL2C #6-55 dotnet600 2018
Making archive IL2C #6-55 dotnet600 2018Kouji Matsui
 

Ähnlich wie C Best and Worst Practices in Embedded (20)

Building reusable libraries
Building reusable librariesBuilding reusable libraries
Building reusable libraries
 
What has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you developWhat has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you develop
 
2014-06-26 - A guide to undefined behavior in c and c++
2014-06-26 - A guide to undefined behavior in c and c++2014-06-26 - A guide to undefined behavior in c and c++
2014-06-26 - A guide to undefined behavior in c and c++
 
Complete c programming presentation
Complete c programming presentationComplete c programming presentation
Complete c programming presentation
 
C++11 and 64-bit Issues
C++11 and 64-bit IssuesC++11 and 64-bit Issues
C++11 and 64-bit Issues
 
Wtf per lineofcode
Wtf per lineofcodeWtf per lineofcode
Wtf per lineofcode
 
(8) cpp abstractions separated_compilation_and_binding_part_i
(8) cpp abstractions separated_compilation_and_binding_part_i(8) cpp abstractions separated_compilation_and_binding_part_i
(8) cpp abstractions separated_compilation_and_binding_part_i
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programming
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Csdfsadf
CsdfsadfCsdfsadf
Csdfsadf
 
C
CC
C
 
C
CC
C
 
A nice 64-bit error in C
A  nice 64-bit error in CA  nice 64-bit error in C
A nice 64-bit error in C
 
A Collection of Examples of 64-bit Errors in Real Programs
A Collection of Examples of 64-bit Errors in Real ProgramsA Collection of Examples of 64-bit Errors in Real Programs
A Collection of Examples of 64-bit Errors in Real Programs
 
C introduction by piyushkumar
C introduction by piyushkumarC introduction by piyushkumar
C introduction by piyushkumar
 
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptx
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptxWINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptx
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptx
 
A Collection of Examples of 64-bit Errors in Real Programs
A Collection of Examples of 64-bit Errors in Real ProgramsA Collection of Examples of 64-bit Errors in Real Programs
A Collection of Examples of 64-bit Errors in Real Programs
 
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!
Kernel Recipes 2014 - Writing Code: Keep It Short, Stupid!
 
Making archive IL2C #6-55 dotnet600 2018
Making archive IL2C #6-55 dotnet600 2018Making archive IL2C #6-55 dotnet600 2018
Making archive IL2C #6-55 dotnet600 2018
 
C programming session3
C programming  session3C programming  session3
C programming session3
 

Mehr von GlobalLogic Ukraine

GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”
GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”
GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”GlobalLogic Ukraine
 
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic Ukraine
 
Штучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxШтучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxGlobalLogic Ukraine
 
Задачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxЗадачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxGlobalLogic Ukraine
 
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxЩо треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxGlobalLogic Ukraine
 
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Ukraine
 
JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"GlobalLogic Ukraine
 
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic Ukraine
 
Страх і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationСтрах і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationGlobalLogic Ukraine
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic Ukraine
 
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic Ukraine
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?GlobalLogic Ukraine
 
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Ukraine
 
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Ukraine
 
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic Ukraine
 
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"GlobalLogic Ukraine
 
GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Ukraine
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"GlobalLogic Ukraine
 
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Ukraine
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
 

Mehr von GlobalLogic Ukraine (20)

GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”
GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”
GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”
 
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
 
Штучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxШтучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptx
 
Задачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxЗадачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptx
 
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxЩо треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
 
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
 
JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"
 
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
 
Страх і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationСтрах і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic Education
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
 
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?
 
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
 
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
 
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
 
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
 
GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"
 
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 

Kürzlich hochgeladen

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Kürzlich hochgeladen (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

C Best and Worst Practices in Embedded

  • 1. 1 C best and worst practices Andrew Lukin 2019, Kharkiv
  • 2. 2 “Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.” Attributed to Albert Einstein
  • 3. 3 Some obscure moments: ternary operator
  • 4. 4 Some obscure moments: ternary operator x ? : y from Android’s QEMU: machine->max_cpus = machine->max_cpus ?: 1; /* Default to UP */ https://android.googlesource.com/platform/external /qemu/+/master/vl-android.c#3472
  • 5. 5 Some obscure moments: ternary operator x ? x : y
  • 6. 6 Some obscure moments: ternary operator x ? x : y It’s ok when 1st operand contain a side effect but with -pedantic you’ll have the following complaints from compiler: warning: ISO C forbids omitting the middle term of a ?: expression
  • 7. 7 Some obscure moments: ternary operator status_color = frobs < 10 ? CODE_GREEN : frobs < 15 ? CODE_YELLOW : frobs < 20 ? CODE_RED : CODE_PURPLE; Is it clear?
  • 8. 8 Some obscure moments: ternary operator status_color = frobs < 10 ? CODE_GREEN : frobs < 15 ? CODE_YELLOW : frobs < 20 ? CODE_RED : CODE_PURPLE; At least format it like that
  • 9. 9 A bit more of potential mistakes from some real driver: if(strlen(ops->name)) { strncpy(n->name, ops->name, (strlen(ops->name) > 79)?79:strlen(ops->name) ); }
  • 10. 10 A bit more of potential mistakes from some real driver: if(strlen(ops->name)) { strncpy(n->name, ops->name, (strlen(ops->name) > 79)?79:strlen(ops->name) ); } --> use strscpy(), for instance
  • 11. 11 Let’s remember your interview for C position void (* signal(int __sig, void (* __func)(int))) (int)
  • 12. 12 Let’s remember your interview for C position void (* signal(int __sig, void (* __func)(int))) (int) Yes, you are right. This is from some old libc… And can be found even now, for instance, in Microchip sources
  • 13. 13 Let’s remember your interview for C position void (* signal(int __sig, void (* __func)(int))) (int) Uncovering the magic
  • 14. 14 Let’s remember your interview for C position void (* signal(int __sig, void (* __func)(int))) (int) Uncovering the magic
  • 15. 15 Let’s remember your interview for C position void (* signal(int __sig, void (* __func)(int))) (int) Uncovering the magic
  • 16. 16 Let’s remember your interview for C position void (* signal(int __sig, void (* __func)(int))) (int) Uncovering the magic
  • 17. 17 Let’s remember your interview for C position void (* signal(int __sig, void (* __func)(int))) (int) Uncovering the magic
  • 18. 18 Let’s remember your interview for C position /* Type of a signal handler. */ typedef void (*__sighandler_t) (int); ... extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) __THROW; glibc developers were wise from the very beginning!
  • 22. 22 --oneline for(p=0;p+=(a&1)*b,a!=1;a>>=1,b<<=1); is equal to: p=0; while (true) { p+=(a&1)*b; if (a == 1) break; ... a>>=1; b<<=1; }
  • 23. 23 Know your language In some code review programmer “fixed” long long to long with comment “Misprint” ...
  • 25. 25 Emoji :-!! /* from Linux kernel */ #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
  • 26. 26 Emoji :-!! /* Force a compilation error if condition is true, but also produce a result (of value 0 and type size_t), so the expression can be used e.g. in a structure initializer (or where-ever else comma expressions aren't permitted). */ #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) Maybe better to name it ...OR_ZERO()
  • 28. 28 Best: Use coding standards A coding standard’s purpose is to restrict use of problematic areas of the programming language.
  • 29. 29 Best: Use coding standards A coding standard’s purpose is to restrict use of problematic areas of the programming language. So, using coding standards prevents undefined or unspecified behavior. And it limits the use of error-prone constructs, such as "goto".
  • 30. 30 Best: Use coding standards A coding standard’s purpose is to restrict use of problematic areas of the programming language. So, using coding standards prevents undefined or unspecified behavior. And it limits the use of error-prone constructs, such as "goto". And using coding standards also improves the code’s readability, maintainability, and portability. One example is the use of “typedef” to simplify the syntax of complex structures.
  • 31. 31 Best: Use coding styles For instance, Linux kernel coding style (remember checkpatch.pl) ● indentation ● breaking long lines and strings ● placing braces and spaces ● ...
  • 32. 32 Best: Use coding styles Or GNU C coding style, for instance: if (foo) if (bar) win (); else lose ();
  • 33. 33 Best: Use coding styles Or GNU C coding style, for instance: if (foo) { if (bar) win (); else lose (); }
  • 34. 34 Best: Use coding styles Or GNU C coding style, for instance: if ((foo = (char *) malloc (sizeof *foo)) == NULL) fatal ("virtual memory exhausted");
  • 35. 35 Best: Use coding styles Or GNU C coding style, for instance: if ((foo = (char *) malloc (sizeof *foo)) == NULL) fatal ("virtual memory exhausted"); instead, write this: foo = (char *) malloc (sizeof *foo); if (foo == NULL) fatal ("virtual memory exhausted");
  • 36. 36 Best: Use coding styles Вопрос на форуме: Уменязапалпробел.Чтомнеделать? Ответ: настоящие_программисты_пробелами_не_пользуются или НастоящиеПрограммистыПробеламиНеПользуются
  • 37. 37 Lower complexity = Better Code Write less code go have beer sooner

Hinweis der Redaktion

  1. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  2. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  3. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  4. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  5. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  6. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  7. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  8. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  9. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  10. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  11. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  12. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  13. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  14. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  15. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  16. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  17. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  18. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  19. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  20. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  21. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  22. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  23. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  24. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  25. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  26. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  27. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  28. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  29. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  30. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  31. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  32. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  33. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  34. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  35. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element
  36. TEXT AND IMAGE – Headline 32pt Arial in BLACK – Body copy & bulleted text 12pt Arial Reg in GRAY; body copy not to go below 10 pt – Left-justify all text and design element