summaryrefslogtreecommitdiff
path: root/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-08-24 19:42:38 +0300
committerPaul Buetow <paul@buetow.org>2024-08-24 19:42:38 +0300
commite1ef1b5f3e21e84fcca29bedee6d1af154d61169 (patch)
treed3873e7e9fb474c99dc2a71ed9bc90f82cba4481 /gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html
parent1891cb99a0eff5fd497edb44c435acdcaf5d8299 (diff)
Update content for html
Diffstat (limited to 'gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html')
-rw-r--r--gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html10
1 files changed, 5 insertions, 5 deletions
diff --git a/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html b/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html
index 82302e43..7c501d60 100644
--- a/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html
+++ b/gemfeed/2016-11-20-object-oriented-programming-with-ansi-c.html
@@ -8,7 +8,7 @@
<link rel="stylesheet" href="style-override.css" />
</head>
<body>
-<h1 style='display: inline' id='ObjectorientedprogrammingwithANSIC'>Object oriented programming with ANSI C</h1><br />
+<h1 style='display: inline' id='object-oriented-programming-with-ansi-c'>Object oriented programming with ANSI C</h1><br />
<br />
<span class='quote'>Published at 2016-11-20T22:10:57+00:00; Updated at 2022-01-29</span><br />
<br />
@@ -23,7 +23,7 @@
<br />
<span>You can do a little of object-oriented programming in the C Programming Language. However, that is, in my humble opinion, limited. It&#39;s easier to use a different programming language than C for OOP. But still it&#39;s an interesting exercise to try using C for this.</span><br />
<br />
-<h2 style='display: inline' id='Functionpointers'>Function pointers</h2><br />
+<h2 style='display: inline' id='function-pointers'>Function pointers</h2><br />
<br />
<span>Let&#39;s have a look at the following sample program. All you have to do is to add a function pointer such as "calculate" to the definition of struct "something_s". Later, during the struct initialization, assign a function address to that function pointer:</span><br />
<br />
@@ -98,7 +98,7 @@ http://www.gnu.org/software/src-highlite -->
<br />
<span>Not complicated at all, but nice to know and helps to make the code easier to read!</span><br />
<br />
-<h2 style='display: inline' id='ThatsnotOOPthough'>That&#39;s not OOP, though</h2><br />
+<h2 style='display: inline' id='thats-not-oop-though'>That&#39;s not OOP, though</h2><br />
<br />
<span>However, that&#39;s not really how it works in object-oriented languages such as Java and C++. The method call in this example is not a method call as "mult" and "div" in this example are not "message receivers". I mean that the functions can not access the state of the "mult" and "div" struct objects. In C, you would need to do something like this instead if you wanted to access the state of "mult" from within the calculate function, you would have to pass it as an argument:</span><br />
<br />
@@ -109,13 +109,13 @@ http://www.gnu.org/software/src-highlite -->
<pre><font color="#ff0000">mult</font><font color="#F3E651">.</font><font color="#7bc710">calculate</font><font color="#F3E651">(</font><font color="#ff0000">mult</font><font color="#F3E651">,</font><font color="#ff0000">a</font><font color="#F3E651">,</font><font color="#ff0000">b</font><font color="#F3E651">));</font>
</pre>
<br />
-<h2 style='display: inline' id='RealobjectorientedprogrammingwithC'>Real object oriented programming with C</h2><br />
+<h2 style='display: inline' id='real-object-oriented-programming-with-c'>Real object oriented programming with C</h2><br />
<br />
<span>If you want to take it further, hit "Object-Oriented Programming with ANSI-C" into your favourite internet search engine or follow the link below. It goes as far as writing a C preprocessor in AWK, which takes some object-oriented pseudo-C and transforms it to plain C so that the C compiler can compile it to machine code. This is similar to how the C++ language had its origins.</span><br />
<br />
<a class='textlink' href='https://www.cs.rit.edu/~ats/books/ooc.pdf'>https://www.cs.rit.edu/~ats/books/ooc.pdf</a><br />
<br />
-<h2 style='display: inline' id='OOPdesignpatternsintheLinuxKernel'>OOP design patterns in the Linux Kernel</h2><br />
+<h2 style='display: inline' id='oop-design-patterns-in-the-linux-kernel'>OOP design patterns in the Linux Kernel</h2><br />
<br />
<span>Big C software projects, like Linux, also follow some OOP techniques:</span><br />
<br />