{"id":55,"date":"2010-07-22T14:38:00","date_gmt":"2010-07-22T12:38:00","guid":{"rendered":"https:\/\/daniel.liljeberg.io\/?p=55"},"modified":"2021-01-29T12:40:31","modified_gmt":"2021-01-29T11:40:31","slug":"object-oriented-development-in-ansi-c","status":"publish","type":"post","link":"https:\/\/daniel.liljeberg.io\/sv\/2010\/07\/22\/object-oriented-development-in-ansi-c\/","title":{"rendered":"Object Oriented development in ANSI C?"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Even though I once started with, and for a long time developed with, procedural languages, over the years I have started to think much more object oriented when I develop. It started when I learned C ++ and has become an intuitive way for me to see systems and solutions to my development problems. A while ago, however, I found myself in the situation of being limited to ANSI C. The code was to be compiled on gcc and thus <strong>new<\/strong>, <strong>class <\/strong>and the like are just to be forgotten. Much of the code in place was written purely procedurally, but that part tried to encapsulate different parts by grouping them in different files and so on. It also clearly struggled with many of the large scale systems issues that C++ aimed to solve.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I also found it surprisingly difficult to completely let go of the object-oriented way of thinking and grew interested in exploring to what degree many of the object oriented ideas could be used in plain ANSI C. This is the first the time I do this, so I learn and come up with new things all the time and a lot will probably be revised. But here are some thoughts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Inheritance<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Inheritance can to some extent be faked by your structs looking identical on the parts they have in common and that all specific parts come last in the structure.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">struct foo {\n  int a;\n  int b;\n}\n\nstruct bar {\n  int a;\n  int b;\n  char* s;\n}\n\nvoid printStruct(struct foo* obj) {\n  fprintf (stderr, \"a:%s \\nb:%s \\n\", obj->a, obj->b);\n  return;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>printStruct <\/strong>will now be able to receive both <strong>foo <\/strong>and <strong>bar<\/strong> structs. But the downside is that you have to type your <strong>bar <\/strong>struct yourself if you want to submit it to the function. The function can also not print the string in a <strong>bar <\/strong>struct as it would be a problem if you had in fact sent a <strong>foo<\/strong> struct. One way to get around this is to let the function take a <strong>void*<\/strong> instead, but then you can really send it anything and it is impossible to know which struct you are really receiving. A &#8220;solution&#8221; may be to have a type of field in your struct. You can then let the function check what type it is and choose what it should do with the struct based on that.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">enum StructType {FOO, BAR};\n\nstruct foo {\n  structType type;\n  int a;\n  int b;\n}\n\nstruct bar {\n  structType type;\n  int a;\n  int b;\n  char* s;\n}\n\nvoid printStruct (void* obj) {\n  \/\/ Type throw to the \"lowest\" type and check the type field\n  switch (((foo*)obj)->type) {\n  case FOO:\n    fprintf (stderr, \"a:%s \\nb:%s \\n\", ((foo *)obj)->a, ((foo*)obj)->b);\n    break;\n  case BAR:\n    fprintf (stderr, \"a:%s \\nb:%s \\ns:%s \\n\", ((foo*)obj)->a, ((foo*)obj)->b, ((foo*)obj)->s);\n    break;\n  default:\n    fprintf (stderr, \"UNKOWN TYPE! \\n\");\n    break;\n  }\n\n  return;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now the function will print the string if it is a <strong>bar <\/strong>struct you submit. Of course, type must be set to the correct value, something that could be managed via &#8220;new&#8221;-functions that create the structs. For example<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">struct foo* MyFoo = NewFoo(aVal, bval);<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I have heard rumors that you should be able to define your struct in such a way that you could actually let the <strong>printStruct<\/strong> function take a pointer to the &#8220;base&#8221; struct, but this is not something I have succeeded with. If anyone knows, feel free to shout.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Private variables<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Normally in object oriented programming we end up having a lot of variables in our objects that we do not really want the end user to touch. In C++ we declare these as <strong>private <\/strong>(or <strong>protected<\/strong>). But in a struct in ANSI C, this possibility does not exist. However, what you can do is fake this to an extent. In you .h file you <strong>declare<\/strong> the struct with something like<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">typedef struct MyObj MyObj;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and then in you .c file you write the actual <strong>definition<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">struct MyObj {\n  int a;\n  int b;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now all your functions in your .c file for the object will know what your struct looks like inside, but for everyone else who only has the declaration in your .h file to go on, the member variables will be &#8220;hidden&#8221;. We have now managed to recreate some of the possibilities with private variables. If you want a static private member variable, you achieve similar functionality by declaring it outside your struct in your .c file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Member functions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Member functions are a big part of object oriented programming. Let&#8217;s say you for instance, have an array of pointers to your objects, all of which can now be of a slightly different type. But we know that everyone should execute a &#8220;run&#8221;-function. However, not every object should do the exact same thing. Here we can do as before to check a type of variable in our struct and based on that choose what we are going to do. Something that is nicer, however, is to use member functions. Something that can be achieved with ANSI C.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">typedef int funcPtr ();\ntypedef struct myObj {\n  int a;\n  int b;\n  funcPtr* run;\n} myObj;\n\ntypedef struct myOtherObj {\n  int a;\n  int b;\n  funcPtr* run;\n  char* s;\n} myOtherObj;\n\nint runOne () {\n  return 1;\n}\n\nint runTwo () {\n  return 2;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In your &#8220;new&#8221;-functions for the different &#8220;objects&#8221; you assign the functions.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">struct MyObj* NewMyObj (int aVal, int bVal) {\n  struct MyObj* this = (stuct MyObj*) malloc (sizeof (struct MyObj));\n  this->a   = aVal;\n  this->b   = bVal;\n  this->run = runOne;\n  return this;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then you can simply call the function on your &#8220;object&#8221;.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">struct MyObj* myObj = NewMyObj (10, 20);\nint result = myObj->run();<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The result will now be <strong>1<\/strong> when we assigned <strong>runOne<\/strong> to our &#8220;run&#8221;-function in the constructor and that function returns <strong>1<\/strong>. If this object were part of an array of objects we could have looped them and run their respective &#8220;run&#8221;-functions and each of the objects could in turn point to completely different implementations of that function.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These were just a few quick things I&#8217;ve come up with in recent days. Feel free to share tips and ideas. Please note that the code above has not been compiled there may be some small errors here and there, but the idea itself should be clear.<\/p>\n\t\t\t<input type=\"hidden\" id=\"wplinkpress-user-email\" value=\"\" \/>\n<input type=\"hidden\" id=\"wplinkpress-authorize-url\" value=\"https:\/\/www.linkedin.com\/oauth\/v2\/authorization?response_type=code&client_id=77uzug7iq2dnd2&redirect_uri=https%3A%2F%2Fdaniel.liljeberg.io%2Fauthorize-linkedin%2F&state=https%3A%2F%2Fdaniel.liljeberg.io%2Fsv%2Fwp-json%2Fwp%2Fv2%2Fposts%2F55&scope=r_liteprofile%20r_emailaddress%20w_member_social\" \/>\n<input type=\"hidden\" id=\"wplinkpress-post-id\" value=\"55\" \/>\n<div class=\"ui wplinkpress comments\">\n<h3 class=\"ui dividing header\">Comments<\/h3>\n<form id=\"add-wplinkpress-comment\" method=\"POST\" action=\"\"> \n<div class=\"comment add-comment\">\n\t<a class=\"avatar\"><img src=\"https:\/\/daniel.liljeberg.io\/wp-content\/plugins\/wplinkpress\/assets\/media\/non-user-icon.jpg\" \/><\/a>\n\t<div class=\"content\">\n\t<textarea id=\"wplinkpress-comment-text-0\" class=\"wplinkpress-comment-text\" style=\"width:100%;\" placeholder=\"Add a comment...\"><\/textarea>\n\t<div class=\"bottom-layer\">\n\t\t<div class=\"comment-atts\" style=\"float:left;\">\n\t\t\t\t<div class=\"feed-share\">\n\t\t<label class=\"switch tips\">\n\t\t\t<input type=\"checkbox\" id=\"toggle-linkedin-feed\" >\n        \t<span class=\"slider round\"><\/span>\n\t\t<\/label>\n\t\t<span>Share on activity feed<\/span>\n\t\t<\/div>\n\t\t<\/div>\n\t<div class=\"wplinkpress_buttons\">\n\t\t<button id=\"authorize_comment_0\" class=\"authorize_comment\" disabled=\"disabled\">Post with LinkedIn<\/button>\n\t\t<\/div>\n\t<\/div>\n\t<\/div>\n<\/div>\n<input type=\"hidden\" name=\"trp-form-language\" value=\"sv\"\/><\/form>\n<h3 class=\"ui dividing header\"><span class=\"wplinkpress-brand\">Powered by WP LinkPress<\/span><\/h3>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Even though I once started with, and for a long time developed with, procedural languages, over the years I have started to think much more object oriented when I develop. It started when I learned C ++ and has become an intuitive way for me to see systems and solutions to my development problems. A&hellip;&nbsp;<a href=\"https:\/\/daniel.liljeberg.io\/sv\/2010\/07\/22\/object-oriented-development-in-ansi-c\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Object Oriented development in ANSI C?<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":560,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","footnotes":""},"categories":[5,4],"tags":[],"class_list":["post-55","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c","category-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Object Oriented development in ANSI C? - Daniel Liljeberg<\/title>\n<meta name=\"description\" content=\"Some Object Oriented ideas in pure ANSI C\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/daniel.liljeberg.io\/sv\/2010\/07\/22\/object-oriented-development-in-ansi-c\/\" \/>\n<meta property=\"og:locale\" content=\"sv_SE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Object Oriented development in ANSI C? - Daniel Liljeberg\" \/>\n<meta property=\"og:description\" content=\"Some Object Oriented ideas in pure ANSI C\" \/>\n<meta property=\"og:url\" content=\"https:\/\/daniel.liljeberg.io\/sv\/2010\/07\/22\/object-oriented-development-in-ansi-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Daniel Liljeberg\" \/>\n<meta property=\"article:published_time\" content=\"2010-07-22T12:38:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-29T11:40:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2010\/07\/The_C_Programming_Language_logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"1360\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Daniel Liljeberg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Skriven av\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Liljeberg\" \/>\n\t<meta name=\"twitter:label2\" content=\"Ber\u00e4knad l\u00e4stid\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minuter\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/\"},\"author\":{\"name\":\"Daniel Liljeberg\",\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/#\\\/schema\\\/person\\\/e2c3fe10971c37cff2669f5688834cd7\"},\"headline\":\"Object Oriented development in ANSI C?\",\"datePublished\":\"2010-07-22T12:38:00+00:00\",\"dateModified\":\"2021-01-29T11:40:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/\"},\"wordCount\":845,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/#\\\/schema\\\/person\\\/e2c3fe10971c37cff2669f5688834cd7\"},\"image\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/daniel.liljeberg.io\\\/wp-content\\\/uploads\\\/2010\\\/07\\\/The_C_Programming_Language_logo.jpg\",\"articleSection\":[\"C\",\"Development\"],\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/\",\"url\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/\",\"name\":\"Object Oriented development in ANSI C? - Daniel Liljeberg\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/daniel.liljeberg.io\\\/wp-content\\\/uploads\\\/2010\\\/07\\\/The_C_Programming_Language_logo.jpg\",\"datePublished\":\"2010-07-22T12:38:00+00:00\",\"dateModified\":\"2021-01-29T11:40:31+00:00\",\"description\":\"Some Object Oriented ideas in pure ANSI C\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/#breadcrumb\"},\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/daniel.liljeberg.io\\\/wp-content\\\/uploads\\\/2010\\\/07\\\/The_C_Programming_Language_logo.jpg\",\"contentUrl\":\"https:\\\/\\\/daniel.liljeberg.io\\\/wp-content\\\/uploads\\\/2010\\\/07\\\/The_C_Programming_Language_logo.jpg\",\"width\":1280,\"height\":1360,\"caption\":\"C Programming Language\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/2010\\\/07\\\/22\\\/object-oriented-development-in-ansi-c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/daniel.liljeberg.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Object Oriented development in ANSI C?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/#website\",\"url\":\"https:\\\/\\\/daniel.liljeberg.io\\\/\",\"name\":\"Daniel Liljeberg\",\"description\":\"The is no place like 127.0.0.1\",\"publisher\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/#\\\/schema\\\/person\\\/e2c3fe10971c37cff2669f5688834cd7\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/daniel.liljeberg.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"sv-SE\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/#\\\/schema\\\/person\\\/e2c3fe10971c37cff2669f5688834cd7\",\"name\":\"Daniel Liljeberg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/DanielLiljeberg.png\",\"url\":\"https:\\\/\\\/daniel.liljeberg.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/DanielLiljeberg.png\",\"contentUrl\":\"https:\\\/\\\/daniel.liljeberg.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/DanielLiljeberg.png\",\"width\":424,\"height\":440,\"caption\":\"Daniel Liljeberg\"},\"logo\":{\"@id\":\"https:\\\/\\\/daniel.liljeberg.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/DanielLiljeberg.png\"},\"description\":\"Agile practitioner and advocate. Strong believer in the future of agile organizations, businesses and teams. Got my first computer, a C64, at age 7 and computers has been part of my life since then. Working professionally with development since the early 2000\u2019s in a vast array of technologies and roles. Social, easy going, fun loving guy with an appetite for new challenges and new knowledge who has been \u201cthere\u201d and done \u201cthat\u201d. That\u2019s a good way to sum it all up. Married and father of three kids. All true blessings ;)\",\"sameAs\":[\"https:\\\/\\\/daniel.liljeberg.io\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/danielliljeberg\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Object Oriented development in ANSI C? - Daniel Liljeberg","description":"Some Object Oriented ideas in pure ANSI C","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/daniel.liljeberg.io\/sv\/2010\/07\/22\/object-oriented-development-in-ansi-c\/","og_locale":"sv_SE","og_type":"article","og_title":"Object Oriented development in ANSI C? - Daniel Liljeberg","og_description":"Some Object Oriented ideas in pure ANSI C","og_url":"https:\/\/daniel.liljeberg.io\/sv\/2010\/07\/22\/object-oriented-development-in-ansi-c\/","og_site_name":"Daniel Liljeberg","article_published_time":"2010-07-22T12:38:00+00:00","article_modified_time":"2021-01-29T11:40:31+00:00","og_image":[{"width":1280,"height":1360,"url":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2010\/07\/The_C_Programming_Language_logo.jpg","type":"image\/jpeg"}],"author":"Daniel Liljeberg","twitter_card":"summary_large_image","twitter_misc":{"Skriven av":"Daniel Liljeberg","Ber\u00e4knad l\u00e4stid":"5 minuter"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/#article","isPartOf":{"@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/"},"author":{"name":"Daniel Liljeberg","@id":"https:\/\/daniel.liljeberg.io\/#\/schema\/person\/e2c3fe10971c37cff2669f5688834cd7"},"headline":"Object Oriented development in ANSI C?","datePublished":"2010-07-22T12:38:00+00:00","dateModified":"2021-01-29T11:40:31+00:00","mainEntityOfPage":{"@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/"},"wordCount":845,"commentCount":0,"publisher":{"@id":"https:\/\/daniel.liljeberg.io\/#\/schema\/person\/e2c3fe10971c37cff2669f5688834cd7"},"image":{"@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/#primaryimage"},"thumbnailUrl":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2010\/07\/The_C_Programming_Language_logo.jpg","articleSection":["C","Development"],"inLanguage":"sv-SE","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/","url":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/","name":"Object Oriented development in ANSI C? - Daniel Liljeberg","isPartOf":{"@id":"https:\/\/daniel.liljeberg.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/#primaryimage"},"image":{"@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/#primaryimage"},"thumbnailUrl":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2010\/07\/The_C_Programming_Language_logo.jpg","datePublished":"2010-07-22T12:38:00+00:00","dateModified":"2021-01-29T11:40:31+00:00","description":"Some Object Oriented ideas in pure ANSI C","breadcrumb":{"@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/#breadcrumb"},"inLanguage":"sv-SE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/"]}]},{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/#primaryimage","url":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2010\/07\/The_C_Programming_Language_logo.jpg","contentUrl":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2010\/07\/The_C_Programming_Language_logo.jpg","width":1280,"height":1360,"caption":"C Programming Language"},{"@type":"BreadcrumbList","@id":"https:\/\/daniel.liljeberg.io\/2010\/07\/22\/object-oriented-development-in-ansi-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/daniel.liljeberg.io\/"},{"@type":"ListItem","position":2,"name":"Object Oriented development in ANSI C?"}]},{"@type":"WebSite","@id":"https:\/\/daniel.liljeberg.io\/#website","url":"https:\/\/daniel.liljeberg.io\/","name":"Daniel Liljeberg","description":"The is no place like 127.0.0.1","publisher":{"@id":"https:\/\/daniel.liljeberg.io\/#\/schema\/person\/e2c3fe10971c37cff2669f5688834cd7"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/daniel.liljeberg.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"sv-SE"},{"@type":["Person","Organization"],"@id":"https:\/\/daniel.liljeberg.io\/#\/schema\/person\/e2c3fe10971c37cff2669f5688834cd7","name":"Daniel Liljeberg","image":{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2020\/12\/DanielLiljeberg.png","url":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2020\/12\/DanielLiljeberg.png","contentUrl":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2020\/12\/DanielLiljeberg.png","width":424,"height":440,"caption":"Daniel Liljeberg"},"logo":{"@id":"https:\/\/daniel.liljeberg.io\/wp-content\/uploads\/2020\/12\/DanielLiljeberg.png"},"description":"Agile practitioner and advocate. Strong believer in the future of agile organizations, businesses and teams. Got my first computer, a C64, at age 7 and computers has been part of my life since then. Working professionally with development since the early 2000\u2019s in a vast array of technologies and roles. Social, easy going, fun loving guy with an appetite for new challenges and new knowledge who has been \u201cthere\u201d and done \u201cthat\u201d. That\u2019s a good way to sum it all up. Married and father of three kids. All true blessings ;)","sameAs":["https:\/\/daniel.liljeberg.io","https:\/\/www.linkedin.com\/in\/danielliljeberg\/"]}]}},"_links":{"self":[{"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":3,"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":562,"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/posts\/55\/revisions\/562"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/media\/560"}],"wp:attachment":[{"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniel.liljeberg.io\/sv\/wp-json\/wp\/v2\/tags?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}