- Structs as User Defined Datatypes (UDTs)
- Basic Features of Structs
- Application Programming Interfaces (APIs)
- Memory Representation of Plain old Datatypes (PODs)
-- Alignment
-- Layout
-- Arrays of Structs
(1) cpp abstractions user_defined_typesNico Ludwig
Check out these exercises: http://de.slideshare.net/nicolayludwig/1-cpp-abstractions-userdefinedtypesexercises
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/1-cpp-abstractions-userdefinedtypes-38528410
- Structs as User Defined Datatypes (UDTs)
- Basic Features of Structs
- Application Programming Interfaces (APIs)
- Memory Representation of Plain old Datatypes (PODs)
-- Alignment
-- Layout
-- Arrays of Structs
(2) cpp abstractions abstraction_and_encapsulationNico Ludwig
- Concepts of Object-Orientation: Abstraction and Encapsulation
- Abstracted Types with Member Functions
- Constructors and default Constructors
- Restricting Access to Members
- Encapsulation with Classes
- Inline Member Functions
- Naming Conventions
(2) cpp abstractions abstraction_and_encapsulationNico Ludwig
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/2-cpp-abstractions-abstractionandencapsulation-38533809
Check out these exercises: http://de.slideshare.net/nicolayludwig/2-cpp-abstractions-abstractionandencapsulationexercises-38533848
- Concepts of Object-Orientation: Abstraction and Encapsulation
- Abstracted Types with Member Functions
- Constructors and default Constructors
- Restricting Access to Members
- Encapsulation with Classes
- Inline Member Functions
- Naming Conventions
Structures allow grouping of related data types under a single name. They are defined using the struct keyword followed by the structure tag name and a block of member declarations. Structure variables can be declared and accessed using the dot (.) operator. Structures allow organizing related data and passing compound data as a single unit. Unions store only one data member at a time, allowing a single variable to be treated as different data types.
This document discusses structures in C++. It defines a structure as a collection of related data items that can be of different types. Structures allow grouping of data together, like elements in a student record. Individual structure members can be accessed using the dot operator. Arrays of structures and structures containing arrays are also discussed. Examples are provided to demonstrate defining, declaring, initializing, and assigning values to structures and nested structures.
The document discusses hash tables and provides an example of creating an unordered map hash table in C++ to store dictionary data with word definitions. It shows how to check if a key exists in the hash table, add a new key-value pair if not found, and iterate through the values for a given key. The reader is then given an exercise to create an unordered map storing country phone codes and names, add a new code if not found, and print the name for a given code.
The document discusses Copy-On-Write (COW) in C++ to avoid unnecessary object copying. It explains passing by reference/pointer, smart pointers, and introduces COW using an example DataBuffer class. COW shares a single copy of the data between objects until one object needs to modify it, at which point it makes a copy so the objects remain independent. The document shows how to implement COW in DataBuffer and Employee classes using smart pointers, making a backup copy before writing, and rolling back if an exception occurs. It notes COW is best for large objects with many copies but few writes.
This document discusses the features and uses of tablets. It notes that tablets can be used to keep track of emails, view documents and media. They are lightweight, have touchscreens, storage capacity of 64GB, screen sizes of 5-12 inches, and incorporate WiFi and mobile internet. Battery life ranges from 5-10 hours. Advantages include fast processors, touchscreens, and battery life, while disadvantages include limited software compatibility and hardware support depending on the brand.
(1) cpp abstractions user_defined_typesNico Ludwig
Check out these exercises: http://de.slideshare.net/nicolayludwig/1-cpp-abstractions-userdefinedtypesexercises
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/1-cpp-abstractions-userdefinedtypes-38528410
- Structs as User Defined Datatypes (UDTs)
- Basic Features of Structs
- Application Programming Interfaces (APIs)
- Memory Representation of Plain old Datatypes (PODs)
-- Alignment
-- Layout
-- Arrays of Structs
(2) cpp abstractions abstraction_and_encapsulationNico Ludwig
- Concepts of Object-Orientation: Abstraction and Encapsulation
- Abstracted Types with Member Functions
- Constructors and default Constructors
- Restricting Access to Members
- Encapsulation with Classes
- Inline Member Functions
- Naming Conventions
(2) cpp abstractions abstraction_and_encapsulationNico Ludwig
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/2-cpp-abstractions-abstractionandencapsulation-38533809
Check out these exercises: http://de.slideshare.net/nicolayludwig/2-cpp-abstractions-abstractionandencapsulationexercises-38533848
- Concepts of Object-Orientation: Abstraction and Encapsulation
- Abstracted Types with Member Functions
- Constructors and default Constructors
- Restricting Access to Members
- Encapsulation with Classes
- Inline Member Functions
- Naming Conventions
Structures allow grouping of related data types under a single name. They are defined using the struct keyword followed by the structure tag name and a block of member declarations. Structure variables can be declared and accessed using the dot (.) operator. Structures allow organizing related data and passing compound data as a single unit. Unions store only one data member at a time, allowing a single variable to be treated as different data types.
This document discusses structures in C++. It defines a structure as a collection of related data items that can be of different types. Structures allow grouping of data together, like elements in a student record. Individual structure members can be accessed using the dot operator. Arrays of structures and structures containing arrays are also discussed. Examples are provided to demonstrate defining, declaring, initializing, and assigning values to structures and nested structures.
The document discusses hash tables and provides an example of creating an unordered map hash table in C++ to store dictionary data with word definitions. It shows how to check if a key exists in the hash table, add a new key-value pair if not found, and iterate through the values for a given key. The reader is then given an exercise to create an unordered map storing country phone codes and names, add a new code if not found, and print the name for a given code.
The document discusses Copy-On-Write (COW) in C++ to avoid unnecessary object copying. It explains passing by reference/pointer, smart pointers, and introduces COW using an example DataBuffer class. COW shares a single copy of the data between objects until one object needs to modify it, at which point it makes a copy so the objects remain independent. The document shows how to implement COW in DataBuffer and Employee classes using smart pointers, making a backup copy before writing, and rolling back if an exception occurs. It notes COW is best for large objects with many copies but few writes.
This document discusses the features and uses of tablets. It notes that tablets can be used to keep track of emails, view documents and media. They are lightweight, have touchscreens, storage capacity of 64GB, screen sizes of 5-12 inches, and incorporate WiFi and mobile internet. Battery life ranges from 5-10 hours. Advantages include fast processors, touchscreens, and battery life, while disadvantages include limited software compatibility and hardware support depending on the brand.
Complementary and alternative medicine has become increasingly popular as people seek natural remedies with fewer side effects than synthetic drugs. Over 40% of adults now use complementary and alternative medicine. Various holistic healing techniques are in high demand, such as Ayurveda, chiropractic, homeopathy, naturopathy, and acupuncture. This document introduces an internationally recognized institution that provides alternative medicine courses and conferences to advance knowledge in these fields.
Juan narra varias anécdotas de su infancia y etapa escolar, incluyendo cuando se perdió en un cementerio a los 3-4 años, su primer día en el jardín de infancia, ser brigadier general en un desfile escolar, tener un amigo invisible, y conocer gemelas que le gustaban. Relata experiencias en la escuela primaria como su primera comunión y graduación, y luego en la secundaria donde fue parte de diversas actividades escolares y religiosas.
sejak lahir manusia mempunyai perilaku khas dan berbeda dari individu satu dengan yang lainnya, terkadang saat kita menilai seseorang tidak tepat pada yang dinilai tersebut.
disini akan diuraikan tipe-tipe manusia berdasarkan sifat, perkataan, sikap atau tingkah laku seseorang tersebut agar kita tidak salah paham untuk menilai sifat baik/buruk seseorang itu tersebut.
This document introduces a new world of hearing with revolutionary hearing devices that can help one hear more naturally with less effort, allowing them to fully participate in social events and conversations. It invites the reader to reawaken the joys of hearing by calling NorthPointe Audiology to learn more about their sleek, stylish, and virtually invisible hearing devices that are developed to help one understand more with less effort.
The document discusses what it takes to be a successful entrepreneur and leader. It defines entrepreneurs as risk-taking individuals who operate businesses and pursue opportunities. Leaders are described as people who guide and inspire others. The document notes that entrepreneurs become successful "entreleaders" by combining an entrepreneur's passion with a leader's character. It provides tips for entrepreneurs such as developing a vision, financial plan, mentoring team, and continuous growth strategy. The document emphasizes adding value for customers, focusing on sales, and monitoring key business metrics like cash flow.
El documento discute cómo la inteligencia emocional, introducida por Daniel Goleman, ha ayudado a mejorar la productividad y el bienestar en el lugar de trabajo. La inteligencia emocional implica el reconocimiento y manejo adecuado de las emociones propias y de los demás para lograr el éxito tanto en la vida personal como profesional. Gracias a la inteligencia emocional, las personas pueden interactuar mejor al comprender los aspectos emocionales inherentes a las relaciones humanas.
Susan Gendron is applying to Argosy University's Master's in Art Degree in Counseling Psychology program. She believes her 20 years of experience in nursing and small business assessing women's health, combined with her undergraduate degree in psychology, provide her with skills that will help disadvantaged communities. Her goal is to become a Licensed Marriage and Family Counselor to meet the complex needs of the local community and focus on strengthening families and young adults.
En rapport om reformering av arbetsförmedlingen.
Centerpartiet vill göra om Arbetsförmedlingen från grunden. Dagens Arbetsförmedling får göra bedömning av vilket stöd arbetssökande behöver och betala för tjänster. Men jobbförmedlingen ska uteslutande skötas av privata aktöter.
The document discusses the importance of continuous visibility in projects. It advocates using a virtual card wall and walk-the-wall standups to provide visibility into progress and issues. This helps the team take corrective action early to avoid surprises. Using a virtual wall allows recording history and metrics. While it lacks a physical feeling, it enables remote participation and tools like a pairing matrix and progress meter. The document further recommends process improvements like limits on in-progress cards.
Presentación Recolócate Job & Career CoachingRecolocatePeru
Recolócate - Perú ofrece servicios de asesoría para la reinserción y recolocación laboral, así como para el desarrollo de carreras profesionales. Brindan diagnósticos profesionales, ajustan CVs, desarrollan habilidades para entrevistas y conectan a clientes con oportunidades laborales a través de su red de contactos y búsquedas en el mercado. También ayudan a definir perfiles, metas y competencias profesionales para potenciar carreras a largo plazo.
Una máquina virtual es un software que emula un ordenador completo, permitiendo ejecutar sistemas operativos de forma aislada sin necesidad de instalarlos físicamente. Existen máquinas virtuales de sistema, que permiten ejecutar múltiples sistemas operativos en una misma máquina física, y máquinas virtuales de proceso, que ejecutan aplicaciones de forma independiente del sistema operativo anfitrión. Un inconveniente es la pérdida de rendimiento frente a la ejecución nativa, aunque la flexibilidad
The Quarter Century Club recognizes these employees and celebrates with them on their successful careers. It's a win-win for all since the added experience helps the health system and in turn the health system doesn't have to spend so much on retraining and getting employees.
This document provides an outline of topics to be covered in chapters about the life of early humans and studying the past. Some of the topics included are the literary sources of Indian history, what epigraphy and inscriptions are, what numismatics is, who wrote Abhigyan Shakuntalam, how the invention of fire helped Paleolithic humans, how Stone Age humans learned about metals, characteristics of Paleolithic tools, and where remains of the Paleolithic age can be found in India.
Structures allow grouping of related data types together under one name. They can contain members of different data types. Structures can be nested by defining one structure as a member of another. Members are accessed using the dot operator. Structures are initialized when declared and one structure can be assigned to another of the same type by copying member values. Examples demonstrate declaring, defining, initializing, accessing, and assigning structures.
(4) c sharp introduction_object_orientation_part_iNico Ludwig
This document provides an introduction to object-oriented programming concepts in C#, including:
- Simulating reality through modeling real-world entities as classes with data fields and behavior methods.
- Relationships between classes like aggregation ("has-a") and generalization ("is-a") hierarchies.
- Defining classes with fields to represent an object's state, and methods to represent its behavior.
- Inheritance and specialization, where derived classes extend base classes while maintaining the substitution principle.
- Other concepts like encapsulation, properties, and class diagrams using UML notation.
This document discusses nested structures and arrays of structures in C programming. It begins by explaining how one structure can be nested within another using separate or embedded structures. It then discusses how to access members of nested structures. The document also explains that an array of structures declares multiple elements of the same structure type. Elements can be accessed and initialized similarly to fundamental data types. It provides examples of declaring, defining, and accessing elements of nested structures and arrays of structures in C code.
Complementary and alternative medicine has become increasingly popular as people seek natural remedies with fewer side effects than synthetic drugs. Over 40% of adults now use complementary and alternative medicine. Various holistic healing techniques are in high demand, such as Ayurveda, chiropractic, homeopathy, naturopathy, and acupuncture. This document introduces an internationally recognized institution that provides alternative medicine courses and conferences to advance knowledge in these fields.
Juan narra varias anécdotas de su infancia y etapa escolar, incluyendo cuando se perdió en un cementerio a los 3-4 años, su primer día en el jardín de infancia, ser brigadier general en un desfile escolar, tener un amigo invisible, y conocer gemelas que le gustaban. Relata experiencias en la escuela primaria como su primera comunión y graduación, y luego en la secundaria donde fue parte de diversas actividades escolares y religiosas.
sejak lahir manusia mempunyai perilaku khas dan berbeda dari individu satu dengan yang lainnya, terkadang saat kita menilai seseorang tidak tepat pada yang dinilai tersebut.
disini akan diuraikan tipe-tipe manusia berdasarkan sifat, perkataan, sikap atau tingkah laku seseorang tersebut agar kita tidak salah paham untuk menilai sifat baik/buruk seseorang itu tersebut.
This document introduces a new world of hearing with revolutionary hearing devices that can help one hear more naturally with less effort, allowing them to fully participate in social events and conversations. It invites the reader to reawaken the joys of hearing by calling NorthPointe Audiology to learn more about their sleek, stylish, and virtually invisible hearing devices that are developed to help one understand more with less effort.
The document discusses what it takes to be a successful entrepreneur and leader. It defines entrepreneurs as risk-taking individuals who operate businesses and pursue opportunities. Leaders are described as people who guide and inspire others. The document notes that entrepreneurs become successful "entreleaders" by combining an entrepreneur's passion with a leader's character. It provides tips for entrepreneurs such as developing a vision, financial plan, mentoring team, and continuous growth strategy. The document emphasizes adding value for customers, focusing on sales, and monitoring key business metrics like cash flow.
El documento discute cómo la inteligencia emocional, introducida por Daniel Goleman, ha ayudado a mejorar la productividad y el bienestar en el lugar de trabajo. La inteligencia emocional implica el reconocimiento y manejo adecuado de las emociones propias y de los demás para lograr el éxito tanto en la vida personal como profesional. Gracias a la inteligencia emocional, las personas pueden interactuar mejor al comprender los aspectos emocionales inherentes a las relaciones humanas.
Susan Gendron is applying to Argosy University's Master's in Art Degree in Counseling Psychology program. She believes her 20 years of experience in nursing and small business assessing women's health, combined with her undergraduate degree in psychology, provide her with skills that will help disadvantaged communities. Her goal is to become a Licensed Marriage and Family Counselor to meet the complex needs of the local community and focus on strengthening families and young adults.
En rapport om reformering av arbetsförmedlingen.
Centerpartiet vill göra om Arbetsförmedlingen från grunden. Dagens Arbetsförmedling får göra bedömning av vilket stöd arbetssökande behöver och betala för tjänster. Men jobbförmedlingen ska uteslutande skötas av privata aktöter.
The document discusses the importance of continuous visibility in projects. It advocates using a virtual card wall and walk-the-wall standups to provide visibility into progress and issues. This helps the team take corrective action early to avoid surprises. Using a virtual wall allows recording history and metrics. While it lacks a physical feeling, it enables remote participation and tools like a pairing matrix and progress meter. The document further recommends process improvements like limits on in-progress cards.
Presentación Recolócate Job & Career CoachingRecolocatePeru
Recolócate - Perú ofrece servicios de asesoría para la reinserción y recolocación laboral, así como para el desarrollo de carreras profesionales. Brindan diagnósticos profesionales, ajustan CVs, desarrollan habilidades para entrevistas y conectan a clientes con oportunidades laborales a través de su red de contactos y búsquedas en el mercado. También ayudan a definir perfiles, metas y competencias profesionales para potenciar carreras a largo plazo.
Una máquina virtual es un software que emula un ordenador completo, permitiendo ejecutar sistemas operativos de forma aislada sin necesidad de instalarlos físicamente. Existen máquinas virtuales de sistema, que permiten ejecutar múltiples sistemas operativos en una misma máquina física, y máquinas virtuales de proceso, que ejecutan aplicaciones de forma independiente del sistema operativo anfitrión. Un inconveniente es la pérdida de rendimiento frente a la ejecución nativa, aunque la flexibilidad
The Quarter Century Club recognizes these employees and celebrates with them on their successful careers. It's a win-win for all since the added experience helps the health system and in turn the health system doesn't have to spend so much on retraining and getting employees.
This document provides an outline of topics to be covered in chapters about the life of early humans and studying the past. Some of the topics included are the literary sources of Indian history, what epigraphy and inscriptions are, what numismatics is, who wrote Abhigyan Shakuntalam, how the invention of fire helped Paleolithic humans, how Stone Age humans learned about metals, characteristics of Paleolithic tools, and where remains of the Paleolithic age can be found in India.
Structures allow grouping of related data types together under one name. They can contain members of different data types. Structures can be nested by defining one structure as a member of another. Members are accessed using the dot operator. Structures are initialized when declared and one structure can be assigned to another of the same type by copying member values. Examples demonstrate declaring, defining, initializing, accessing, and assigning structures.
(4) c sharp introduction_object_orientation_part_iNico Ludwig
This document provides an introduction to object-oriented programming concepts in C#, including:
- Simulating reality through modeling real-world entities as classes with data fields and behavior methods.
- Relationships between classes like aggregation ("has-a") and generalization ("is-a") hierarchies.
- Defining classes with fields to represent an object's state, and methods to represent its behavior.
- Inheritance and specialization, where derived classes extend base classes while maintaining the substitution principle.
- Other concepts like encapsulation, properties, and class diagrams using UML notation.
This document discusses nested structures and arrays of structures in C programming. It begins by explaining how one structure can be nested within another using separate or embedded structures. It then discusses how to access members of nested structures. The document also explains that an array of structures declares multiple elements of the same structure type. Elements can be accessed and initialized similarly to fundamental data types. It provides examples of declaring, defining, and accessing elements of nested structures and arrays of structures in C code.
Со времён С++98 стандартные контейнеры и идиома RAII позволяли избегать использования оператора delete,
что делало код более безопасным. С приходом С++11 и умных указателей отпала необходимость использовать оператор new, что позволило практически полностью переложить управление памятью на плечи компилятора. В
докладе объясняется идеология управления памятью и ресурсами в современном С++.
The document discusses avoiding new and delete in modern C++ code by using smart pointers and containers provided by the standard library and third-party libraries. It provides examples of managing memory with new/delete in C and early C++ compared to modern approaches using classes, constructors, destructors, and smart pointers. The document also discusses specific cases where new and delete may still be needed, such as with intrusive reference counting objects and some GUI frameworks. Overall, it promotes using make functions like make_unique, make_shared, and containers by default to simplify memory management in C++.
(4) cpp abstractions references_copies_and_const-nessNico Ludwig
- The STL Type std::string
- C++ References and Const References
- More on RAII:
-- Copy Constructors
-- Temporary and Anonymous Objects
-- Type Conversion
- Const-ness in C++
-- Const Member Functions
-- Const Correctness
-- Mutable Fields
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/2-cpp-imperative-programming-38499061
Check out these exercises: http://de.slideshare.net/nicolayludwig/2-cpp-imperative-programmingexercises
- Imperative Programming
- Style and Conventions
- Constants
- Fundamental Types
- Console Basics
- Operators, Precedence, Associativity and Evaluation Order
- Control Structures and Blocks
Check out these exercises: http://de.slideshare.net/nicolayludwig/2-cpp-imperative-programmingexercises
- Imperative Programming
- Style and Conventions
- Constants
- Fundamental Types
- Console Basics
- Operators, Precedence, Associativity and Evaluation Order
- Control Structures and Blocks
1. The document summarizes key concepts about C/C++ including program structure, data types like arrays and structures, pointers, dynamic memory allocation, and linked lists.
2. Pointers allow accessing and modifying the value at a memory address, and are used with dynamic memory allocation functions like malloc() to allocate and free memory dynamically at runtime.
3. Linked lists provide dynamic memory structures by linking nodes together using pointers, with doubly-linked lists using two pointers in each node - one to the next node and one to the previous.
The document discusses classes, objects, and methods in object-oriented programming. It introduces the Dice class as an example, which models the behavior and properties of dice. The Dice class has private member variables to store the number of sides and rolls, and public methods like Roll() and NumSides() to access and manipulate these properties. The document explains concepts like encapsulation, properties, static methods, and the importance of classes and objects in organizing code into reusable components.
(3) cpp abstractions more_on_user_defined_typesNico Ludwig
The document discusses C++ abstractions related to managing object lifetimes and dynamic memory. It introduces the concepts of creating objects on the freestore using new/delete rather than malloc/free, and how destructors allow objects to automatically free resources when going out of scope through RAII (Resource Acquisition Is Initialization). This avoids issues like forgetting to free memory. Copies of objects can also be avoided by passing references instead of values.
The document outlines a lecture plan for object oriented programming. It covers topics like structures and classes, function overloading, constructors and destructors, operator overloading, inheritance, polymorphism, and file streams. It provides examples to explain concepts like structures, classes, access specifiers, friend functions, and operator overloading. The document also includes questions for students to practice these concepts.
This document discusses structures in C programming. It defines a structure as a collection of different data types grouped together. Each element in a C structure is called a member. Structures allow storing of different data types under one name. Some key points covered include declaring and initializing structures, accessing structure members, nested structures, array of structures, passing structures to functions, and using structures with pointers and typedef. Examples are provided to demonstrate these concepts.
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDSSumant Tambe
The document summarizes the Data Distribution Service (DDS) data-centric communication model. DDS uses a typed data-centric approach where:
1) Data objects have a type and obey type rules.
2) Middleware maintains the state of each data object and caches objects for applications to read.
3) Objects are identified by keys and have configurable quality of service settings for reliability, ownership, history and more.
Records (structs) provide a way to organize related data into a single data type called a struct. A struct allows grouping of different data types together under one name. It can contain simple and complex data types as members. Structs are useful for representing records like student records, bank accounts, and address books. Members of a struct are accessed using the dot operator, and arrays of structs can be used to represent multiple records.
This lecture covers overloaded functions, constant objects and member functions, friend functions, the this pointer, static data members, and composition with objects as members of classes. Specifically, it discusses:
1) Overloading constructors to initialize objects with different values.
2) Using const to declare objects, member functions, and data members as constant to prevent modification.
3) Defining member functions outside the class and using the scope resolution operator.
4) Passing objects as arguments to other functions and returning objects.
5) Using the this pointer implicitly and explicitly to access members of the current object.
6) Declaring static data members that are shared across all objects of a class.
1. The document discusses different ways of creating custom data types in C++, including classes, structures, unions, enumerations, and typedef. Structures are collections of variables that can be referenced under one name.
2. Technically, there is no difference between a structure and a class in C++ - structures are classes with members that are public by default, while classes have private members by default.
3. Structures allow logically related elements to be treated as a single unit, for example to store student information. Arrays can contain elements of a structure type.
Similar to (1) cpp abstractions user_defined_types (20)
Von Gleichungen zu Funktionen
Überblick über ganzrationale Funktionen
Koordinatensysteme für Graphen ganzrationaler Funktionen mit Excels Liniendiagrammen erstellen
Einfache Analyse ganzrationaler Funktionen anhand deren Graphen
Von linearen zu quadratischen Gleichungssystemen
Verschiedene Möglichkeiten quadratische Gleichungssysteme grafisch zu lösen
Koordinatensysteme für quadratische Graphen mit Excels Liniendiagrammen erstellen und Gleichungen damit grafisch lösen
Grafische Interpretation der Lösungen von Normalparabel-Gerade Kombinationen
Diagramme
Einführung linearer Gleichungssysteme mit zwei Unbekannten
Rechnerische und grafische Lösung linearer Gleichungssysteme
Wertetabellen mit Excel erstellen
Koordinatensysteme und lineare Graphen mit Excels Liniendiagrammen erstellen und Gleichungen damit grafisch lösen
Mit großen Tabellen arbeiten
Sortieren und Filtern
Objekte einfügen
Formeln und rechnen mit Excel, insbesondere Zahlen und Textbearbeitung
Relative und absolute Zellbezüge
Funktionen: SUMME(), ANZAHL(), MIN(), MAX(), MITTELWERT(), JETZT(), HEUTE(), ZUFALLSZAHL(), PI() und SUMMEWENN()
Mathematische Probleme in Tabellenform
Geschichtliche Entwicklung
Grundlegende Konzepte und Begriffe in Excel
Selektion, Dateneingabe und Datentypen
Zellformatierung und Inhaltsformatierung
This document discusses the history and evolution of graphical user interfaces (GUIs) in web browsers. It begins by explaining the concepts of vector-based and raster-based graphics. It then describes early approaches using bare HTML pages, which felt like navigation rather than a true application. Plugins were introduced to provide richer content but had problems with resources, installation, and security. Finally, the document introduces HTML5 Canvas as a solution for continuous, event-driven drawing without plugins, allowing single-page web applications.
The document discusses different approaches to drawing graphics on a computer screen, including raster-based and vector-based graphics. It focuses on raster-based drawing APIs and their evolution from native platform-specific APIs to platform-independent APIs in web browsers. Key developments included the use of browser plugins, problems with plugins, and the introduction of HTML5 Canvas which enables interactive drawing in browsers without plugins.
- Wires and Bulbs
- Batch Processing
- Terminal and Mainframe
- From the Command-Line to Killer Applications
- Vector Displays and Raster Displays
- Color Displays
- The Mouse and the Takeoff of Interactivity
- The Desktop Metaphor
- Wires and Bulbs
- Batch Processing
- Terminal and Mainframe
- From the Command-Line to Killer Applications
- Vector Displays and Raster Displays
- Color Displays
- The Mouse and the Takeoff of Interactivity
- The Desktop Metaphor
This document discusses new features in C# 4 including home-brew dynamic dispatch using the DynamicObject class. It allows implementing custom dynamic behavior by overriding methods like TryInvokeMember. The document also covers hosting scripting languages with the Dynamic Language Runtime (DLR), including IronPython, IronRuby, and IronScheme. Dynamic dispatch enables seamless collaboration and controlled isolation between .NET and DLR-based languages.
This document discusses new features in C# 4 related to dynamic coding. It describes how dynamic typing allows easier COM automation without needing interop types. Anonymous type instances can now be passed to methods using dynamic parameters. The document also discusses dynamic objects in JavaScript and how ExpandoObjects in .NET allow objects to have dynamically added and modified properties at runtime similar to dynamic objects in JavaScript.
This document discusses the Dynamic Language Runtime (DLR) and dynamic coding features in C# 4. It provides an overview of the DLR and how it allows interoperability between statically and dynamically typed languages on the .NET framework. The DLR transforms dynamic operations in C# into calls to the DLR at compile time and handles dynamic dispatch at runtime. It uses expression trees to represent operations in a language-agnostic way and caches binding results for improved performance.
This document discusses new features related to dynamic programming in C# 4. It begins by explaining why dynamic typing is an important new feature in .NET 4 due to increasing needs for interoperability. It then provides an overview of dynamic typing concepts like late binding and duck typing. The document shows how these concepts are implemented in VB for dynamic programming and how C#4 introduces dynamic typing capabilities through the new "dynamic" keyword and Dynamic Language Runtime (DLR) while still being a statically typed language. It discusses the basic syntax for using dynamics in C#4 and some restrictions.
This document summarizes new generic types and features in C# 4, including Lazy<T> for deferred initialization, tuples for ad-hoc data structures, and generic variance. Generic variance allows covariant and contravariant conversions between generic types to promote substitutability. It was enabled for interfaces and delegates in C# 4 through explicit variance declarations like "out T" and "in T". This improves type safety over arrays, which allow unsafe covariance in C#.
This document discusses LINQ (Language Integrated Query) features in C#, including introducing LINQ to Objects, basic query expressions for projection and selection, and anonymous types. It provides examples of how LINQ to Objects maps to extension methods, functional and declarative expressibility using LINQ, details about the LINQ translation process from query expressions to method calls, and examples of using anonymous types.
The document discusses LINQ and C# algorithms. It compares the C++ STL algorithm model to the .NET algorithm model using IEnumerable<T> sequences and extension methods. Key points include:
- The .NET model uses deferred execution via IEnumerable<T> sequences and iterator blocks, avoiding intermediate collections and allowing multiple operations to be chained.
- Extension methods allow algorithms to be expressed via method chaining in a declarative way rather than using loops.
- IEnumerable<T> sequences are more readable, uniform, and composable than the STL model due to chaining and deferred execution.
This document summarizes new C# 3.0 features including implicit typing, lambda expressions, and extension methods. Implicit typing allows declaring variables without an explicit type using the 'var' keyword. Lambda expressions provide a concise way to pass code as arguments using the '=>' operator. Extension methods allow adding methods to existing types without modifying them by defining methods in static classes that take the extended type as the first parameter.
Skybuffer SAM4U tool for SAP license adoptionTatiana Kojar
Manage and optimize your license adoption and consumption with SAM4U, an SAP free customer software asset management tool.
SAM4U, an SAP complimentary software asset management tool for customers, delivers a detailed and well-structured overview of license inventory and usage with a user-friendly interface. We offer a hosted, cost-effective, and performance-optimized SAM4U setup in the Skybuffer Cloud environment. You retain ownership of the system and data, while we manage the ABAP 7.58 infrastructure, ensuring fixed Total Cost of Ownership (TCO) and exceptional services through the SAP Fiori interface.
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfChart Kalyan
A Mix Chart displays historical data of numbers in a graphical or tabular form. The Kalyan Rajdhani Mix Chart specifically shows the results of a sequence of numbers over different periods.
Introduction of Cybersecurity with OSS at Code Europe 2024Hiroshi SHIBATA
I develop the Ruby programming language, RubyGems, and Bundler, which are package managers for Ruby. Today, I will introduce how to enhance the security of your application using open-source software (OSS) examples from Ruby and RubyGems.
The first topic is CVE (Common Vulnerabilities and Exposures). I have published CVEs many times. But what exactly is a CVE? I'll provide a basic understanding of CVEs and explain how to detect and handle vulnerabilities in OSS.
Next, let's discuss package managers. Package managers play a critical role in the OSS ecosystem. I'll explain how to manage library dependencies in your application.
I'll share insights into how the Ruby and RubyGems core team works to keep our ecosystem safe. By the end of this talk, you'll have a better understanding of how to safeguard your code.
Dive into the realm of operating systems (OS) with Pravash Chandra Das, a seasoned Digital Forensic Analyst, as your guide. 🚀 This comprehensive presentation illuminates the core concepts, types, and evolution of OS, essential for understanding modern computing landscapes.
Beginning with the foundational definition, Das clarifies the pivotal role of OS as system software orchestrating hardware resources, software applications, and user interactions. Through succinct descriptions, he delineates the diverse types of OS, from single-user, single-task environments like early MS-DOS iterations, to multi-user, multi-tasking systems exemplified by modern Linux distributions.
Crucial components like the kernel and shell are dissected, highlighting their indispensable functions in resource management and user interface interaction. Das elucidates how the kernel acts as the central nervous system, orchestrating process scheduling, memory allocation, and device management. Meanwhile, the shell serves as the gateway for user commands, bridging the gap between human input and machine execution. 💻
The narrative then shifts to a captivating exploration of prominent desktop OSs, Windows, macOS, and Linux. Windows, with its globally ubiquitous presence and user-friendly interface, emerges as a cornerstone in personal computing history. macOS, lauded for its sleek design and seamless integration with Apple's ecosystem, stands as a beacon of stability and creativity. Linux, an open-source marvel, offers unparalleled flexibility and security, revolutionizing the computing landscape. 🖥️
Moving to the realm of mobile devices, Das unravels the dominance of Android and iOS. Android's open-source ethos fosters a vibrant ecosystem of customization and innovation, while iOS boasts a seamless user experience and robust security infrastructure. Meanwhile, discontinued platforms like Symbian and Palm OS evoke nostalgia for their pioneering roles in the smartphone revolution.
The journey concludes with a reflection on the ever-evolving landscape of OS, underscored by the emergence of real-time operating systems (RTOS) and the persistent quest for innovation and efficiency. As technology continues to shape our world, understanding the foundations and evolution of operating systems remains paramount. Join Pravash Chandra Das on this illuminating journey through the heart of computing. 🌟
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
5th LF Energy Power Grid Model Meet-up SlidesDanBrown980551
5th Power Grid Model Meet-up
It is with great pleasure that we extend to you an invitation to the 5th Power Grid Model Meet-up, scheduled for 6th June 2024. This event will adopt a hybrid format, allowing participants to join us either through an online Mircosoft Teams session or in person at TU/e located at Den Dolech 2, Eindhoven, Netherlands. The meet-up will be hosted by Eindhoven University of Technology (TU/e), a research university specializing in engineering science & technology.
Power Grid Model
The global energy transition is placing new and unprecedented demands on Distribution System Operators (DSOs). Alongside upgrades to grid capacity, processes such as digitization, capacity optimization, and congestion management are becoming vital for delivering reliable services.
Power Grid Model is an open source project from Linux Foundation Energy and provides a calculation engine that is increasingly essential for DSOs. It offers a standards-based foundation enabling real-time power systems analysis, simulations of electrical power grids, and sophisticated what-if analysis. In addition, it enables in-depth studies and analysis of the electrical power grid’s behavior and performance. This comprehensive model incorporates essential factors such as power generation capacity, electrical losses, voltage levels, power flows, and system stability.
Power Grid Model is currently being applied in a wide variety of use cases, including grid planning, expansion, reliability, and congestion studies. It can also help in analyzing the impact of renewable energy integration, assessing the effects of disturbances or faults, and developing strategies for grid control and optimization.
What to expect
For the upcoming meetup we are organizing, we have an exciting lineup of activities planned:
-Insightful presentations covering two practical applications of the Power Grid Model.
-An update on the latest advancements in Power Grid -Model technology during the first and second quarters of 2024.
-An interactive brainstorming session to discuss and propose new feature requests.
-An opportunity to connect with fellow Power Grid Model enthusiasts and users.
GraphRAG for Life Science to increase LLM accuracyTomaz Bratanic
GraphRAG for life science domain, where you retriever information from biomedical knowledge graphs using LLMs to increase the accuracy and performance of generated answers
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
A Comprehensive Guide to DeFi Development Services in 2024Intelisync
DeFi represents a paradigm shift in the financial industry. Instead of relying on traditional, centralized institutions like banks, DeFi leverages blockchain technology to create a decentralized network of financial services. This means that financial transactions can occur directly between parties, without intermediaries, using smart contracts on platforms like Ethereum.
In 2024, we are witnessing an explosion of new DeFi projects and protocols, each pushing the boundaries of what’s possible in finance.
In summary, DeFi in 2024 is not just a trend; it’s a revolution that democratizes finance, enhances security and transparency, and fosters continuous innovation. As we proceed through this presentation, we'll explore the various components and services of DeFi in detail, shedding light on how they are transforming the financial landscape.
At Intelisync, we specialize in providing comprehensive DeFi development services tailored to meet the unique needs of our clients. From smart contract development to dApp creation and security audits, we ensure that your DeFi project is built with innovation, security, and scalability in mind. Trust Intelisync to guide you through the intricate landscape of decentralized finance and unlock the full potential of blockchain technology.
Ready to take your DeFi project to the next level? Partner with Intelisync for expert DeFi development services today!
Your One-Stop Shop for Python Success: Top 10 US Python Development Providersakankshawande
Simplify your search for a reliable Python development partner! This list presents the top 10 trusted US providers offering comprehensive Python development services, ensuring your project's success from conception to completion.
Programming Foundation Models with DSPy - Meetup SlidesZilliz
Prompting language models is hard, while programming language models is easy. In this talk, I will discuss the state-of-the-art framework DSPy for programming foundation models with its powerful optimizers and runtime constraint system.
Have you ever been confused by the myriad of choices offered by AWS for hosting a website or an API?
Lambda, Elastic Beanstalk, Lightsail, Amplify, S3 (and more!) can each host websites + APIs. But which one should we choose?
Which one is cheapest? Which one is fastest? Which one will scale to meet our needs?
Join me in this session as we dive into each AWS hosting service to determine which one is best for your scenario and explain why!
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slackshyamraj55
Discover the seamless integration of RPA (Robotic Process Automation), COMPOSER, and APM with AWS IDP enhanced with Slack notifications. Explore how these technologies converge to streamline workflows, optimize performance, and ensure secure access, all while leveraging the power of AWS IDP and real-time communication via Slack notifications.
Digital Marketing Trends in 2024 | Guide for Staying AheadWask
https://www.wask.co/ebooks/digital-marketing-trends-in-2024
Feeling lost in the digital marketing whirlwind of 2024? Technology is changing, consumer habits are evolving, and staying ahead of the curve feels like a never-ending pursuit. This e-book is your compass. Dive into actionable insights to handle the complexities of modern marketing. From hyper-personalization to the power of user-generated content, learn how to build long-term relationships with your audience and unlock the secrets to success in the ever-shifting digital landscape.
1. 1
(1) C++ Abstractions
Nico Ludwig (@ersatzteilchen)
2. 2
TOC
● (1) C++ Abstractions
– Structs as User Defined Datatypes (UDTs)
– Basic Features of Structs
– Application Programming Interfaces (APIs)
– Memory Representation of Plain old Datatypes (PODs)
● Alignment
● Layout
● Arrays of Structs
● Sources:
– Bruce Eckel, Thinking in C++ Vol I
– Bjarne Stroustrup, The C++ Programming Language
3. 3
Separated Data that is not independent
● Let's assume following two functions dealing with operations on a date:
– (The parameters: d for day, m for month and y for year.)
void PrintDate(int d, int m, int y) {
std::cout<<d<<"."<<m<<"."<<y<<std::endl;
}
void AddDay(int* d, int* m, int* y) {
/* pass */
}
● We can then use them like this:
// Three independent ints representing a single date:
int day = 17;
int month = 10;
int year = 2012;
PrintDate(day, month, year);
// >17.10.2012
// Add a day to the date. It's required to pass all the ints by pointer,
// because an added day could carry over to the next month or year.
AddDay(&day, &month, &year);
PrintDate(day, month, year); // The day-"part" has been modified.
// >18.10.2012
4. 4
There are Problems with this Approach
● Yes! The presented solution works!
– We end in a set of functions (and later also types).
– Such a set to help implementing software is called an Application Programming Interface (API).
– An API is a kind of collection of building blocks to create applications.
● But there are several very serious problems with our way of dealing with dates:
– We have always to pass three separate ints to different functions.
– We have to know that these separate ints belong together.
– The "concept" of a date is completely hidden! - We have "just three ints".
– So, after some time of developing you have to remember the concept once again!
– => These are serious sources of difficult-to-track-down programming errors!
● The problem: we have to handle pieces of data that virtually belong together!
– The "belonging together" defines the concept that we have to find.
5. 5
A first Glimpse: User defined Types (UDTs)
● To solve the problem w/ separated data we'll introduce a User Defined Type (UDT).
– For the time being we'll create and use a so called struct with the name Date
– and belonging to functions operating on a Date object/instance/example.
void PrintDate(Date date) {
std::cout<<date.day<<"."<<date.month<<"."<<date.year<<std::endl;
}
void AddDay(Date* date) { /* pass */ }
struct Date {
int day;
int month;
int year;
};
● We can use instances of the UDT Date like this:
– With the dot-notation the fields of a Date instance can be accessed.
– The functions PrintDate()/AddDay() just accept Date instances as arguments.
// Three independent ints are stored into one Date object/instance:
Date today;
today.day = 17; // The individual fields of a Date can be accessed w/ the dot-notation.
today.month = 10;
today.year = 2012;
PrintDate(today);
// >17.10.2012
AddDay(&today); // Add a day to the date. We only need to pass a single Date object by pointer.
PrintDate(today); // Date's day-field has been modified.
// >18.10.2012
● Arrays are also UDTs!
● The phrase "belonging to function" can be clearly
explained now, e.g. the function PrintDate()
depends on the bare presence of the definition of
the UDT Date!
● Why do we need to pass a Date by pointer to the
function AddDay()?
• Because AddDay() needs to modify the passed
Date.
6. 6
Basic Features of Structs – Part I
● C/C++ structs allow defining UDTs.
– A struct can be defined in a namespace (also the global namespace) or locally.
– A struct contains a set of fields collecting a bunch of data making up a concept.
– Each field needs to have a unique name in the struct.
– The struct Date has the fields day, month and year, all of type int.
– (UDT-definitions in C/C++ (e.g. structs) need to be terminated with a semicolon!)
struct Date {
int day;
int month;
int year;
};
struct Person {
};
– The fields of a struct can be of arbitrary type.
● Fields can be of fundamental type.
const char* name;
Date birthday;
Person* superior;
● Fields can also be of another UDT! - See the field birthday in the struct Person.
● Fields can even be of a pointer of the being-defined UDT! - See the field superior in Person.
– The order of fields doesn't matter conceptually.
● But the field-order matters as far layout/size of struct instances in memory is concerned.
● In C# and Java, the syntactic definitions of UDTs
are not terminated by semicolons!
7. 7
Basic Features of Structs – Part II
● A struct can generally be used like any fundamental type:
– We can create objects incl. arrays of structs.
● The terms object and instance (also example) of UDTs/structs are often used synonymously.
– We can get the address of and we can have pointers to struct instances.
– We can create instances of a struct on the stack or on the heap.
Date myDate; // Create a Date object on the stack.
myDate.day = 1; // Set and access a Date's fields w/ the dot notation...
myDate.month = 2;
myDate.year = 2012;
Date someDates[5]; // Create an array of five (uninitialized) Dates.
Date* pointerToDate = &myDate; // Get the address of a Date instance.
– Functions can have struct objects as parameters and can return struct objects.
// A function returning a Date object:
Date CreateDate(int d, int m, int y) {
Date date;
date.day = d;
date.month = m;
date.year = y;
return date;
}
// A function accepting a Date object:
void PrintDay(Date date) {
/* pass */
}
● In a future lecture we'll learn how to create UDTs
on the heap.
8. 8
Basic Features of Structs – Part III
● C++ has a compact initializer syntax to create new struct instances on the stack.
– Just initialize a new instance with a comma separated list of values put into braces.
– The instance's fields will be initialized in the order of the list and in the order of their appearance in the struct definition.
– => The order in the initializer and in the struct definition must match!
// Initialize a Date object with an initializer:
Date aDate = {17, 10, 2012};
C++11 – uniformed initializers
Date CreateDate(int d, int m, int y) {
return {d, m, y};
}
PrintDate({17, 10, 2012});
int age{19}; // Also for builtin types.
// Create a Date object on the stack...
Date aDate;
aDate.day = 1; // ...and set its fields w/ the dot
aDate.month = 2; // notation individually.
aDate.year = 2012;
// Ok! The field year will default to 0:
Date aDate2 = {10, 2012};
// Invalid! Too many initializer elements:
Date aDate3 = {11, 45, 17, 10, 2012};
● Instances can also be created directly from a named/anonymous struct definition.
struct { // Creates an object directly from
int x, y; // an anonymous struct.
} point;
point.x = 3;
point.y = 4;
struct Point { // Creates an object directly
int x, y; // from a struct definition.
} point;
point.x = 3;
point.y = 4;
● The initializer syntax for structs can also be used
for builtin types: int age = {29};
9. 9
Basic Features of Structs – Part IV
● The size of a UDT can be retrieved with the sizeof operator.
– The size of a UDT is not necessarily the sum of the sizes of its fields.
● Because of gaps! - More to come in short...
struct Date { // 3 x 4B
int day;
int month;
int year;
};
std::cout<<sizeof(Date)<<std::endl;
// >12
● In C/C++ we'll often have to deal with a pointer to a UDT's instance, e.g.:
Date aDate = {17, 10, 2012};
Date* pointerToDate = &aDate; // Get the address of a Date instance.
● UDT-pointers are used very often, C/C++ provide special means to work w/ them:
int day = (*pointerToDate).day; // Dereference pointerToDate and read day w/ the dot.
int theSameDay = pointerToDate->day; // Do the same with the arrow operator.
pointerToDate->month = 11; // Arrow: Dereference pointerToDate and write month.
++pointerToDate->year; // Arrow: Dereference pointerToDate and increment year.
● The arrow-notation (->) is used very often in C/C++, we have to understand it!
(*pointerToDate).day pointerToDate->day
10. 10
UDTs and Instances
● The idea of a UDT is the invention of a new type, composed of other types.
– UDTs can be composed of fundamental types and/or composed of other UDTs.
– => UDTs make APIs really powerful, simple to use and simple to document.
● In general programming terms UDTs are often called record-types.
– In C++, record-types can be defined with structs, classes and unions.
– An API consisting of free functions and record-types is a record-oriented API.
// Blue print:
struct Coordinates {
int x;
int y;
};
● UDTs and instances:
// A concrete instance of the blue print
Coordinates location = {15, 20};
// that consumes memory:
std::size_t size = sizeof(location);
std::cout<<size<<std::endl;
// >8
– A UDT is like a blue print of a prototypical object.
● E.g. like the fundamental type int is a blue print.
– An object is a concrete instance of a UDT that consumes memory during run time.
● E.g. like a variable i or the literal 42 represent instances or objects of the type int.
C++11 – get the size of a field
std::size_t size = sizeof(Coordinates::x);
11. 11
Memory Representation of Structs – PODs
pi
struct Fraction {
int num;
int denom;
};
Fraction pi;
● UDTs only containing fields are often called plain old datatypes (PODs).
– PODs have special features concerning memory we're going to analyze now.
● Similar to arrays, a struct's fields reside in memory as a sequential block.
– The Fraction pi is created on the stack, i.e. all its fields are stored on the stack as well.
– The first field of pi (pi.num) resides on the lowest address, next fields on higher ones.
– The address of the struct instance (&pi) is the same as of its first field (&pi.num).
● W/o context, the address of pi could be the address of a Fraction instance or an int.
– Assigning 22 to pi.num does really assign to the offset of 0B to pi's base address.
● As pi.denom is 4B above pi.num's address, the 7 is stored to &pi plus an offset of 4B.
? pi.denom
? pi.num
&pi (Fraction*)
&pi.num (int*)
4B
8B
higher addresses
pi.num = 22;
pi.denom = 7;
7
22
● Definitions: num := numerator, denom :=
denominator
● A very stringent definition of PODs: A POD
contains only fields of fundamental type; this
makes a PODs self-contained. Self-contained
PODs have no dependencies to other UDTs that
makes using them very straight forward (this is
esp. relevant for tool support).
● Meanwhile C++11 provides a less stringent
definition of PODs.
● The necessity of a struct's fields being arranged at
sequential addresses (incl. the first field having
the lowest address, representing the address of a
struct instance) doesn't hold true, if a UDT applies
access specifiers (private, protected and public).
12. 12
Memory Representation of Structs – Natural Alignment
● Many CPU architectures need objects of fundamental type to be naturally aligned.
– This means that the object's address must be a multiple of the object's size.
– So, the natural alignment (n.a.) of a type is the multiplicator of its valid addresses.
● In a UDT, the field w/ the largest n.a. type sets the n.a. of the whole UDT.
– This is valid for record-types (e.g. structs), arrays and arrays of struct instances.
– The resulting n.a. is called the n.a. of the UDT.
– Here some examples (LLVM GCC 4.2, 64b Intel):
struct A {
char c;
};
sizeof(A): 1
Alignment: 1
struct B {
char c;
char ca[3];
};
sizeof(B): 4
Alignment: 1
struct C {
double d;
char* pc;
int i;
};
sizeof(C): 24
Alignment: 8
C++11 – get the alignment of a type
std::size_t alignment = alignof(A);
std::cout<<alignment<<std::endl;
// >1
C++11 – control the alignment of a type
alignas(double) char array[sizeof(double)];
● On a closer look, the size of C seems to be too large! Let's understand why...
13. 13
Memory Representation of Structs – Layout
● Field order of T1: the memory layout is sequential, rectangular and contiguous.
– The field with the largest n.a. (the double a) controls T1's n.a. (8B).
– Two int-fields can reside at word boundaries and will be packed (2x4B "under" a's 8B).
– The packed fields lead to a size of 16B for T1.
● Field order of T2: the memory layout is sequential, rectangular but not contiguous.
– The field with the largest n.a. (the double a) controls T2's n.a. (also 8B).
– The n.a. of the fields b and c (ints at word boundaries) causes gaps, this is called padding.
– This field order leads to a size of 24B for T2.
● => The order of fields can influence a UDT's size.
struct T2 {
int b;
double a;
int c;
};
sizeof(T2): 24
Alignment: 8
struct T1 {
double a;
int b;
int c;
};
sizeof(T1): 16
Alignment: 8 T2
c
24B a
b
T1
c
a
4B
16B
b
higher addresses
padding bytes
● In .Net the memory representation of structs
(value types) can be controlled with the custom
attribute StructLayout.
14. 14
Memory Representation of Structs – Cast Contact Lenses
Fraction pi;
pi.num = 22;
pi.denom = 7; 7
● The Fraction-object pi is created on the stack.
&pi.denom (int*)
● The &pi.denom is really pointing to an int, after the cast it is seen as &Fraction!
– In other words: &pi.denom is seen as an address of another complete Fraction (*f1).
– The &pi.denom is now seen as the num field of the overlapping Fraction instance (*f1)!
Writing f1->num will really write to pi.denom due to the overlap (&pi.denom + 0B)
– Writing f1->denom will really write to foreign memory (&pi.denom + 4B)!
– We do not own the memory at &pi.denom + 4B!
pi
22
(Fraction*)
12
higher addresses
?
7
*f1 (Fraction)
f1->num = 12;
f1->denom = 33;
Fraction* f1 = reinterpret_cast<Fraction*>(&pi.denom);
33
12
struct Fraction {
int num;
int denom;
};
● Pointer arithmetics only work with arrays. This
feature is exploited for STL operations.
15. 15
Memory Representation of Structs – Pointer-Fields to Heap
struct Student {
char* name;
char id[8];
int nUnit;
};
Student jon;
● Memory facts of jon:
jon
4B
?
– The address of jon.name (as it is the first field) is also the address of jon.
jon.id
– The content of jon.name is not contained in jon, jon.name points to a c-string in heap.
– The field jon.id occupies 8B, stores a c-string of seven chars and is contained in jon.
– The field jon.nUnit stores an int that is also contained in jon.
? jon.nUnit
? jon.name
16B
higher addresses
const char* name = "Jon";
jon.name = static_cast<char*>(std::malloc(sizeof(char) * (1 + std::strlen(name))));
std::strcpy(jon.name, name);
std::strcpy(jon.id, "1234567");
jon.nUnit = 21;
21
? ? ? ?
? ? ? ?
0x00076f2c
'5' '6' '7' 0
'1' '2' '3' '4'
'J' 'o' 'n' 0
● In which kind of memory is jon.name stored? And
where is the memory, to which jon.name is
pointing to?
● The field jon.name is special, as it only contains
a pointer to the "real" c-string (the pointer (the
"cord") resides on the stack). The memory
occupied by this c-string (the "balloon") resides
somewhere in the heap. The address stored in
jon.name is also the address of the c-string's
first char.
● It also means that the memory at jon.name
needs to be freed after we're done with jon!
● Why has the char* a size of 4B?
● The size of all pointer types is the size of the
architecture's address space. On a 32-bit
system: 4 = sizeof(int*), on a 64-bit system: 8 =
sizeof(int*), etc.
● The address of jon could be a Student* or char**.
16. ? ? ? ?
? ? ? ?
16
Memory Representation of Structs – Arrays of Structs
Student pupils[4];
pupils[0].nUnit = 21;
pupils[2].name = strdup("Adam");
'5' ? '6' ? '7' ? '8'
?
'1' ? '2' ? '3' ? '4'
?
pupils
?
?
?
?
? ? ? ?
? ? ? ?
?
● The memory layout of a struct-array is the same as the layout of other arrays.
● Assigning a pointer to another pointer makes both point to the same memory location.
● Assigning a c-string leads to occupation of adjacent bytes incl. the 0 termination.
● Assigning a c-string that overlaps reserved memory overwrites adjacent bytes!
– This is "ok" in this case: we overwrite only bytes within the array. We are the owner!
– But the values in the affected Student instances (pupils[0] and pupils[1]) are corrupted.
?
?
? ? ? ?
? ? ? ?
?
?
?
?
21
'A' 'd' 'a' 'm' 0
0x0022c680
pupils[3].name = pupils[2].name;
std::strcpy(pupils[1].id, "4041543");
std::strcpy(pupils[0].id, "123456789ABCDE"); // Oops!
'5' '4' '3' 0
'4' '0' '4' '1'
'D' 'E' 0 ? 0x0022c680
'9' 'A' 'B' 'C'
?
● In which kind of memory is the array pupils stored?
● Why is the function strdup() not prefixed with std?
● This function is not in the namespace std, because
it is no C++ standard function. But it is defined in
the POSIX "standard".
char* strdup (const char* str){ // No standard C/C++, but defined in
char* dynStr = str
? static_cast<char*>(std::malloc((1 + std::strlen(str)) * sizeof(char)))
: 0;
return dynStr ? std::strcpy(dynStr, str) : 0;
● What is POSIX?
// POSIX.
● The Portable Operating System Interface (POSIX)
is an IEEE- and Open Group-standard for a
platform-independent API to operate with the OS.
● If two pointers point to the same location in the heap,
the memory must only be freed from one of those
pointers!
}