Utah Code Camp, Spring 2016. http://utahcodecamp.com In this presentation I describe modern C++. Modern C++ assumes features introduced in the C++11/14 standard. An overview of the new features is presented and some idioms for mdoern C++ based on those features are presented.
C++ provides backwards compatability with C, but you will have an easier time if you stay away from certain C-style programming habits. This presentation outlines traps and pitfalls from C style programming in C++ and recommends pure C++ alternatives that lead to fewer surprises, fewer errors and better code. This presentation hasn't been updated for C++11 and is based on C++03.
Utah Code Camp, Spring 2016. http://utahcodecamp.com In this presentation I describe modern C++. Modern C++ assumes features introduced in the C++11/14 standard. An overview of the new features is presented and some idioms for mdoern C++ based on those features are presented.
C++ provides backwards compatability with C, but you will have an easier time if you stay away from certain C-style programming habits. This presentation outlines traps and pitfalls from C style programming in C++ and recommends pure C++ alternatives that lead to fewer surprises, fewer errors and better code. This presentation hasn't been updated for C++11 and is based on C++03.
BCA, JIMS Vasant Kunj-II teaches C language to First Semester students. In this pdf, you can read the fundamentals of Array. JIMS Vasant Kunj-II is one of the best BCA colleges in Delhi NCR with an updated Curriculum.
I am Allen K. I am a Computer Science Assignment Help Expert at programminghomeworkhelp.com. I hold a Ph.D. in Programming, The University of Chicago, USA. I have been helping students with their homework for the past 9 years. I solve assignments related to Computer Science.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.
You can also call on +1 678 648 4277 for any assistance with Computer Science assignments.
A minimal collection of most wanted and widely accepted idioms and coding conventions for C++ development presented with examples and explanations. The lecture targets performance oriented codes so emphasis is on performance-friendly techiques.
Topics covered:
1) Design issues: idioms and best practices
- Resource Aquisition Is Initialization (RAII)
- Ownership semantics and smart pointers
- Header files: dependencies and decoupling
2) Objects Construction/Destruction/Copying
- Designing constructors
- Rule Of Three
- Transactional programming
3) Namespaces
- ADL/Koenig Lookup
4) Static analyzers
BCA, JIMS Vasant Kunj-II teaches C language to First Semester students. In this pdf, you can read the fundamentals of Array. JIMS Vasant Kunj-II is one of the best BCA colleges in Delhi NCR with an updated Curriculum.
I am Allen K. I am a Computer Science Assignment Help Expert at programminghomeworkhelp.com. I hold a Ph.D. in Programming, The University of Chicago, USA. I have been helping students with their homework for the past 9 years. I solve assignments related to Computer Science.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.
You can also call on +1 678 648 4277 for any assistance with Computer Science assignments.
A minimal collection of most wanted and widely accepted idioms and coding conventions for C++ development presented with examples and explanations. The lecture targets performance oriented codes so emphasis is on performance-friendly techiques.
Topics covered:
1) Design issues: idioms and best practices
- Resource Aquisition Is Initialization (RAII)
- Ownership semantics and smart pointers
- Header files: dependencies and decoupling
2) Objects Construction/Destruction/Copying
- Designing constructors
- Rule Of Three
- Transactional programming
3) Namespaces
- ADL/Koenig Lookup
4) Static analyzers
Custom Android App Development – Web Animation IndiaMarion Welch
Being associate intimate Android App Development Company, our Android dev team offers a guarantee to our purchasers for a wonderful Android app development service that maximizes the potency of their businesses. we tend to ar exploitation fashionable technologies to form a client’s business complete that competes with today’s technology-obsessed world. Our Android developers have a powerful command of Java, C, C++ HTML, CSS that helps them to write down apps for the Android platform. Our Android app development team develops associate app for pretty much all Google Play’s major classes, as well as social networking, travel, utility, diversion, education, e-commerce so on.
This presentation was created about a month ago in light of his resignation. However, recently, Steve Jobs has passed away and these quotes become evermore real of his brilliance and courage to change the world. Remember his legacy and the impact he left on all of us.
Rest in peace Steve Jobs. 1955-2011
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and ... Note: This page does not list esoteric programming languages. .... Computer programming portal ...
Programming is hard. Programming correct C and C++ is particularly hard. Indeed, both in C and certainly in C++, it is uncommon to see a screenful containing only well defined and conforming code.Why do professional programmers write code like this? Because most programmers do not have a deep understanding of the language they are using.While they sometimes know that certain things are undefined or unspecified, they often do not know why it is so. In these slides we will study small code snippets in C and C++, and use them to discuss the fundamental building blocks, limitations and underlying design philosophies of these wonderful but dangerous programming languages.
This content has a CC license. Feel free to use it for whatever you want. You may download the original PDF file from: http://www.pvv.org/~oma/DeepC_slides_oct2012.pdf
The notes covers the topic THE CLR AND THE .NET FRAMEWORK in C#.net
You will learn about creating assemblies and strong names for them
in CLR via C#. More specifically, you will learn about:
Defining Assemblies
Differentiate the Assembly Types
Creating Strong names
Creating an assembly cache
Working with Directories
Installing Assemblies
Signing into an Assembly
Configuring the assembly
Tamper resistant assemblies
Resolving an assembly reference
Explaining the process of locating and binding assembles
Lightning web components are custom HTML elements built using HTML and modern JavaScript. Lightning Web Components uses core Web Components standards and provides only what’s necessary to perform well in browsers supported by Salesforce.
Advantages of .NET over the other languages, overview of .NET binaries, Intermediate Language, metadata, .NET Namespaces, Common Language runtime, common type system, common Language Specification.
C# fundamentals – C# class, object, string formatting, Types, scope, constants, C# iteration, control flow, operators, array, string, Enumerations, structures, custom Namespaces
Similar to Consuming and Creating Libraries in C++ (20)
Vintage Computing Festival Midwest 18 2023-09-09 What's In A Terminal.pdfRichard Thomson
Terminals were the main user interface for interactive computing throughout the 1960s, 1970s, 1980s and into the 1990s. Eventually the personal computer or workstation displaced the terminal as the 'face' of the computers we use. What's inside a terminal and how does it work? In this talk, Richard Thomson takes a look at the internal architecture of several different CRT terminals: the Beehive B100, the DEC VT100 and the HP 2648A. We look at how these terminals are different as well as their similarities, and ask the question 'How does a terminal differ from a microcomputer?' and provide some reasonable answers.
This presentation shows how to use CMake to probe the platform (operating system/environment) and compiler to identify required or optional language/platform features. A complete example is shown for adapting a program to discovered features.
An overview of how to consume 3rd party C++ libraries with CMake.
Methods covered include: find_package, pkg-config and writing a custom CMake Find Module.
BEFLIX is an embedded domain-specific language for generating computer animated films. BEFLIX was created by Ken Knowlton in 1963 for the IBM 7090 mainframe computer with a Stromberg-Carlson SC2040 microfilm recorder for output. Ken Knowlton created BEFLIX while working at Bell Laboratories and used it to make a number of artistic, educational and engineering films.
Cross Platform Mobile Development with Visual Studio 2015 and C++Richard Thomson
Utah Code Camp, Spring 2016. http://utahcodecamp.com In this presentation, I give an overview of using Visual Studio 2015 for cross-platform development in C++.
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppGoogle
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-fusion-buddy-review
AI Fusion Buddy Review: Key Features
✅Create Stunning AI App Suite Fully Powered By Google's Latest AI technology, Gemini
✅Use Gemini to Build high-converting Converting Sales Video Scripts, ad copies, Trending Articles, blogs, etc.100% unique!
✅Create Ultra-HD graphics with a single keyword or phrase that commands 10x eyeballs!
✅Fully automated AI articles bulk generation!
✅Auto-post or schedule stunning AI content across all your accounts at once—WordPress, Facebook, LinkedIn, Blogger, and more.
✅With one keyword or URL, generate complete websites, landing pages, and more…
✅Automatically create & sell AI content, graphics, websites, landing pages, & all that gets you paid non-stop 24*7.
✅Pre-built High-Converting 100+ website Templates and 2000+ graphic templates logos, banners, and thumbnail images in Trending Niches.
✅Say goodbye to wasting time logging into multiple Chat GPT & AI Apps once & for all!
✅Save over $5000 per year and kick out dependency on third parties completely!
✅Brand New App: Not available anywhere else!
✅ Beginner-friendly!
✅ZERO upfront cost or any extra expenses
✅Risk-Free: 30-Day Money-Back Guarantee!
✅Commercial License included!
See My Other Reviews Article:
(1) AI Genie Review: https://sumonreview.com/ai-genie-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
#AIFusionBuddyReview,
#AIFusionBuddyFeatures,
#AIFusionBuddyPricing,
#AIFusionBuddyProsandCons,
#AIFusionBuddyTutorial,
#AIFusionBuddyUserExperience
#AIFusionBuddyforBeginners,
#AIFusionBuddyBenefits,
#AIFusionBuddyComparison,
#AIFusionBuddyInstallation,
#AIFusionBuddyRefundPolicy,
#AIFusionBuddyDemo,
#AIFusionBuddyMaintenanceFees,
#AIFusionBuddyNewbieFriendly,
#WhatIsAIFusionBuddy?,
#HowDoesAIFusionBuddyWorks
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
4. Program
"The text of the program is kept in units called source files. A
source file together with all the headers and source files
included via the preprocessor directive #include, less any
lines skipped by conditional inclusion preprocessing
directives, is called a translation unit."
[2.1 lex.separate]
"A program consists of one or more translation units linked
together. A translation unit consists of a sequence of
declarations."
[3.5 basic.link]
5. Declarations and Definitions
"A declaration may introduce one or more names into a translation
unit or redeclare names introduced by previous declarations.
A declaration is a definition unless it declares a function without
specifying the function's body, it contains the extern specifier or
a linkage specification and neither an initializer nor a function
body, it declares a static data member in a class definition, it is a
class name declaration, it is an opaque enum declaration, it is a
template parameter, it is a parameter declaration in a function
declarator that is not a declarator of a function definition, or it is a
typedef declaration, an alias declaration, a using declaration, a
static assert declaration, an empty declaration, or a using
directive."
[3.1 basic.def]
7. Examples of Declarations
extern int a; // declares a
extern const int c; // declares c
int f(int); // declares f
struct S; // declares S
typedef int Int; // declares Int
extern X anotherX; // declares anotherX
using N::d; // declares d
8. Examples of Definitions
int a; // defines a
extern const int c = 1; // defines c
int f(int x) { return x+a; } // defines f and defines x
struct S { int a; int b; }; // defines S, S::a, and S::b
struct X { // defines X
int x; // defines non-static data member x
static int y; // declares static data member y
X(): x(0) { } // defines a constructor of X
};
int X::y = 1; // defines X::y
enum { up, down }; // defines up and down
namespace N { int d; } // defines N and N::d
namespace N1 = N; // defines N1
X anX; // defines anX
9. One Definition Rule
"No translation unit shall contain more than one
definition of any variable, function, class type,
enumeration type, or template. [...]
Every program shall contain exactly one definition of
every non-inline function or variable that is used in that
program. [...]
Exactly one definition of a class is required in a
translation unit if the class is used in a way that requires
the class to be complete. [...]"
[3.2 basic.def.odr]
10. One Definition Rule
"There can be more than one definition of a class type,
enumeration type, inline function with external linkage,
class template, non-static function template, static data
member of a class template, member function of a class
template, or template specialization for which some
template parameters are not specified in a program
provided that each definition appears in a different
translation unit and provided the definitions [are the
same]."
[3.2 basic.def.odr]
11. Linkage
"A name is said to have linkage when it might denote the
same object, reference, function, type, template, namespace
or value as a name introduced in another scope:
When a name has external linkage, the entity it denotes
can be referred to by names from scopes of other
translation units or from other scopes of the same
translation unit.
When a name has internal linkage, the entity it denotes
can be referred to by names from other scopes in the same
translation unit.
When a name has no linkage, the entity it denotes cannot
be referred to by names from other scopes."
[3.5 basic.link]
12. The Preprocessor
Processes preprocessor directives:
#include, #define, #if, etc.
Expands macro invocations with macro bodies
Expansion proceeds recursively
The result is a sequence of tokens for the compiler.
Header files act as a massive copy/paste of file contents
into your source files. Megabytes of copy/paste...
This is why your builds are slow.
Modules in C++ are the solution, but not in C++17 :-(
13. The Compiler
Invokes the preprocessor on source files for you.
Receives a stream of tokens from the preprocessor.
Performs syntactic and semantic analysis on the token
stream to produce a sequence of declarations.
Some of those declarations are definitions.
Definitions allocate space for data or instructions.
The output of compilation is an object file.
The object file encodes the output of compilation:
definitions provided by the translation unit.
references to declarations with external linkage.
14. The Linker
Accepts object files from compilation.
Resolves declarations with external linkage.
Produces an executable file for the run-time loader.
15. The Run-Time Loader
Accepts executables from linking.
Establishes a new process for the executable.
Performs any dynamic linking necessary for the executable:
locates dynamic library dependencies
resolves imported symbols by binding them from the
dynamic library exporting the symbols
Transfers execution control to the new process.
16. Symbols and Declarations
A symbol is a name used to communicate declarations between the compiler,
the linker and the run-time loader.
Every declaration with external linkage results in a unique symbol.
The process of encoding each C++ identifier into a unique symbol is
implementation dependent and is called "name mangling".
Declarations can be overloaded, located within a namespace, const/volatile
qualified, etc., all of which can change the mangled name.
The linker and run-time loader deal exclusively with mangled symbols.
Name mangling can be suppressed with C linkage (extern "C").
Interoperability with other languages is achieved through C linkage.
17. What is a Library?
Declares facilities for use by an application.
Defines the implementation for use by an application.
Good libraries define good abstractions.
18. What is a Header Only Library?
Provided as one or more header files.
The declarations and definitions are in the headers.
No linking necessary to use the library.
Just tell your compiler where to find the files.
Often referred to as a compile-time dependency of an
executable.
19. Declarations and Definitions?!?
Function definitions are declared inline.
Their definitions are identical for each source file
including the header.
Therefore they are allowed by the ODR.
20. What is a Static Library?
An archive of object files.
Produced by the linker/archiver from a set of object files.
May contain indices to accelerate resolution of declarations
with external linkage.
When supplied to the linker, a static library acts as if all of
its constituent object files were supplied individually to the
linker.
Often referred to as a static dependency of an executable.
21. Mechanics of Static Libraries
Object
File
Object
File
Static Library
Link
Object
File
Object
File
22. Dependencies of Static Libraries
Source code of a static library can depend on facilities
provided by another static library or another dynamic
library.
This creates implicit library dependencies for clients of this
static library.
These dependencies accumulate transitively until they are
resolved by linking an executable file.
CMake can handle this dependency chain automatically.
23. Consuming a Static Library
Object files provide definitions, but not declarations.
Header files provide declarations, but not definitions.
Consuming a static library consists of:
supplying the header files to the compiler
supplying the library to the linker
24. Creating a Static Library
Create header files containing declarations.
Create source files containing definitions for the
declarations.
Compile all source files to be included in the library.
Link the resulting object files into a static library.
Make the headers and the library available to clients.
25. What is a Dynamic Library?
Also called a shared object or shared library.
Instructions and constant data are shared by all running clients.
Produced by the linker from a collection of object files, static libraries and
dynamic libraries.
Encoded as an executable file for use by the run-time loader with:
A table of exported names provided by this library.
A table of imported names consumed by this library from other dynamic
libraries.
Supplied to the linker as an input to resolve names in an executable and mark
them as supplied by the dynamic library.
Some of the mechanics of shared libraries differ between OS platforms.
26. Mechanics of Dynamic Libraries
Static
Library
Dynamic
Library
Dynamic
Library
Link
Object
File
Object
File
27. Dependencies of Dynamic Libraries
Source code of a dynamic library can depend on facilities
provided by another static library or another dynamic
library.
This creates implicit dynamic library dependencies for
clients of this dynamic library.
Static dependencies are resolved when linking the dynamic
library.
CMake can handle this dependency chain automatically.
28. Consuming a Dynamic Library
Dynamic library provides definitions to the run-time
loader.
Header files provide declarations for the definitions.
Consuming a dynamic library consists of:
supplying the header files to the compiler
supplying the dynamic library to the linker
supplying the dynamic library and its dynamic library
dependencies to the run-time loader
29. Creating a Dynamic Library
Create header files containing declarations.
Create source files containing definitions for the
declarations.
Compile all source files to be included in the library.
Link the resulting object files into a dynamic library.
Make the headers and the library available to clients.
30. Principles of Library Design*
REP: The Release-Reuse Equivalency Principle
CCP: The Common Closure Principle
CRP: The Common Reuse Principle
ADP: The Acyclic Dependencies Principle
SDP: The Stable Dependencies Principle
SAP: The Stable Abstraction Principle
* From "Agile Principles, Patterns and Practices in C#" by Robert Martin and Micah Martin
31. REP: The Release-Reuse
Equivalency Principle
The granule of reuse is the granule of release.
The granule of reuse, a library, can be no smaller than
the granule of release. Anything that we reuse must
also be released and tracked.
Either all the classes in a library are reusable or none of
them are.
32. CCP: The Common
Closure Principle
The classes in a library should be closed together
against the same kinds of changes. A change that
affects a library affects all the classes in that library
and no other libraries.
This is the single responsibility principle (SRP) applied
to libraries.
CCP gathers together in one place all the classes that
are likely to change for the same reasons.
33. CRP: The Common Reuse Principle
The classes in a library are reused together. If you
reuse one of the classes in a library, you reuse them all.
Classes that are tightly coupled to each other should
be in the same library.
Classes that are not tightly bound to each other with
class relationships should not be in the same library.
34. ADP: The Acyclic
Dependencies Principle
Allow no cycles in the library dependency graph.
Cycles manifest themselves in link command-lines for
executables where libraries are repeated as link inputs.
Break cycles by introducing new libraries containing
classes on which other libraries depend.
35. SDP: The Stable
Dependencies Principle
Depend in the direction of stability.
Changes in dependencies cause testing and
integration to propagate up the dependency chain.
36. SAP: The Stable
Abstractions Principle
A library should be as abstract as it is stable.
A stable library should be abstract so that its stability
does not prevent it from being extended.
An instable library should be concrete, since its
instability allows the code within it to be easily
changed.
37. Principles for Header Libraries
REP: the granularity of release is the header file.
CCP: the same kind of change should affect all the classes
in the header.
CRP: the classes in a header-only library should all be
reused together.
ADP: there should be no preprocessor inclusion cycles.
SDP: the header should only depend on more stable
headers.
SAP: the more a header is included by other headers and
source files, the more abstract it should be.
38. Principles for Static Libraries
REP: the granularity of release is the library and all of its
header files.
CCP: the same kind of change should affect all the classes
in the library.
CRP: all the classes in the library are used together.
ADP: there are no link cycles in the library dependency
graph.
SDP: the library should depend only on more stable
libraries.
SAP: the more stable the library is, the more abstract its
header interface should be.
39. Principles for Dynamic Libraries
REP: the granularity of release is the library and all of its
header files.
CCP: the same kind of change should affect all the classes
in the library.
CRP: all the classes in the library are used together.
ADP: there are no link cycles in the library dependency
graph or in the run-time dependency graph.
SDP: the library should depend only on more stable
libraries, either static or dynamic.
SAP: the more stable the library is, the more abstract its
header interface should be.
40. Abstract Interfaces in C++
Template classes/functions use static polymorphism to
express abstract relationships (concepts) between
themselves and their template parameters.
Concepts can simplify the syntax and directly express
the abstract relationships, but not in C++17 :-(
Clients implement concepts, leaving the
implementation free to change without inducing
change on the clients.
41. Abstract Interfaces in C++
Static and dynamic libraries can use dynamic
polymorphism (virtual functions) to express abstract
relationships between their classes and their clients.
Publish interfaces as pure virtual base classes
implemented by the library classes.
Clients depend on interfaces, leaving the
implementation free to change without inducing
change in clients.
43. Bonus Material!
Order of initialization of global data
Global data in static dependencies of dynamic libraries
44. Order of Initialization
"Non-local variables with static storage duration are
initialized as a consequence of program initiation.
Non-local variables with thread storage duration are
initialized as a consequence of thread [initiation]."
[3.6.2 basic.start.init]
45. Static Initialization
"Variables with static storage duration or thread storage
duration shall be zero-initialized before any other
initialization takes place.
Constant initialization is performed [if the initializing
expression is constant]. [...]
Together, zero-initialization and constant initialization are
called static-initialization; all other initialization is dynamic
initialization.
Static initialization shall be performed before any dynamic
initialization takes place."
[3.6.2 basic.start.init]
46. Dynamic Initialization
"Dynamic initialization of a non-local variable with static
storage duration is either ordered or unordered. [...]
Variables with ordered initialization defined within a single
translation unit shall be initialized in the order of their
definitions within a translation unit.
[The] initialization of a variable is indeterminately sequenced
with respect to the initialization of a variable defined in a
different translation unit.
It is implementation-defined whether the dynamic
initialization of a non-local variable with static storage
duration is done before the first statement of main."
[3.6.2 basic.start.init]
47. Example of Indeterminate Ordering
// g.cpp
extern int f(int);
static int g = f(1);
// is g 2 or 3?
// h.cpp
extern int f(int);
static int h = f(2);
// is h 3 or 4?
// f.cpp
int f(int x) {
static int val = 0;
return ++val + x;
}
48. Linking Dynamic Libraries
Against Static Libraries
Dynamic
Library 1
Link
Object
File 1
Static
Library 1
Dynamic
Library 2
Link
Object
File 2
Static
Library 1
49. Intentions Subverted
Static Library 1 intended that it should have a single copy of its
global data in any program.
Dynamic Library 1 has an instance of Static Library 1's global
data.
Dynamic Library 2 has an instance of Static Library 1's global
data.
Any executable using both dynamic libraries has two copies of
Static Library 1's global data.
Now you have mysterious bugs....
50. Intentions Upheld
Use Static Library 1 as a dynamic library instead.
Use Dynamic Library 1 and Dynamic Library 2 as static
libraries instead and static dependencies linked once
into executable.
Using dynamic libraries has a tendency to induce the
requirement of dynamic libraries elsewhere.
Simplest solution:
all libraries static
all libraries dynamic