Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #60328 > unrolled thread
| Started by | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| First post | 2015-04-18 10:26 -0700 |
| Last post | 2015-04-22 11:44 -0700 |
| Articles | 20 on this page of 68 — 12 participants |
Back to article view | Back to comp.lang.c
Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-18 10:26 -0700
Objects in C asetofsymbols@gmail.com - 2015-04-18 10:54 -0700
Objects in C asetofsymbols@gmail.com - 2015-04-18 11:52 -0700
Re: Objects in C Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> - 2015-04-18 19:02 +0000
Re: Objects in C BGB <cr88192@hotmail.com> - 2015-04-18 15:08 -0500
Re: Objects in C BGB <cr88192@hotmail.com> - 2015-04-18 16:46 -0500
Re: Objects in C Keith Thompson <kst-u@mib.org> - 2015-04-18 15:41 -0700
Re: Objects in C August Karlstrom <fusionfile@gmail.com> - 2015-04-19 11:48 +0200
Re: Objects in C BGB <cr88192@hotmail.com> - 2015-04-19 09:32 -0500
Re: Objects in C Keith Thompson <kst-u@mib.org> - 2015-04-19 07:55 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 09:27 -0700
Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 20:52 +0200
Re: Objects in C BGB <cr88192@hotmail.com> - 2015-04-19 16:01 -0500
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:50 -0700
Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-20 22:49 +0200
Re: Objects in C Keith Thompson <kst-u@mib.org> - 2015-04-19 13:54 -0700
Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 23:05 +0200
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:53 -0700
Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-20 22:47 +0200
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 10:14 -0700
Re: Objects in C raltbos@xs4all.nl (Richard Bos) - 2015-04-20 10:25 +0000
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:58 -0700
Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 12:47 +0200
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 09:53 -0700
Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 19:19 +0200
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 09:43 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:37 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:41 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-22 11:50 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-23 10:02 -0700
Re: Objects in C Chad <cdalten@gmail.com> - 2015-04-23 11:12 -0700
Re: Objects in C Chad <cdalten@gmail.com> - 2015-04-23 12:10 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-25 02:31 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-25 10:19 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-26 08:45 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-27 08:37 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-28 08:27 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-28 08:59 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-30 07:32 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-30 09:19 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-01 04:21 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-05-01 10:37 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-03 10:54 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-03 12:19 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-03 13:45 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-03 13:58 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-05 05:56 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-06 16:09 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-06 19:30 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-03 14:02 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-05-04 12:21 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-06 16:39 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-05-07 12:59 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-09 12:42 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-05-10 11:15 -0700
Re: Objects in C luser droog <luser.droog@gmail.com> - 2015-04-25 13:37 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-26 07:13 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-26 08:40 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-28 08:23 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-26 08:07 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 10:13 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-04-20 12:49 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-04-23 16:13 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-24 09:58 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-04-24 19:14 -0700
Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-04-25 22:13 -0700
Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-26 08:40 -0700
Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-22 11:44 -0700
Page 1 of 4 [1] 2 3 4 Next page →
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-04-18 10:26 -0700 |
| Subject | Objects in C |
| Message-ID | <14aac167-b724-458d-80f2-cc7a300e1ff3@googlegroups.com> |
After all these years uncertainty still reigns about what
object-oriented computing is all about. I have my own opinions
and this groups seems like a good place to present my techniques
and, perhaps, get some useful feedback.
I consider objects a good way to organize processes. I also
prefer to code in C. By C I mean 1990 ANSI C.
By "class" I mean a pair of a struct type and a function. I
would define them both in a .h file along with an optional
enum. An object of the class is a variable of the struct type.
Suppose I want to use foobar objects. To do this I declare
typedef struct {...} FooBar;
void* foobar (int m, void* o, void* d);
where m is a method number (perhaps defined by an enum), o
is variable of type FooBar and d is additional data.
I prefer to clone variables. So I could call method 0 the
clone method and write
FooBar* fb = foobar (0, 0, 0);
Where cloning 0 creates a default FooBar object.
To inherit I just make a call to a parent class. To multiply
inherit it is necessary to change the method numbers to
inherit from all but one of the parent classes.
Some things people insist on - like polymorphism - seem to
me perhaps useful but easy to get along without.
Reactions ?
[toc] | [next] | [standalone]
| From | asetofsymbols@gmail.com |
|---|---|
| Date | 2015-04-18 10:54 -0700 |
| Message-ID | <bad7e814-ee83-4241-abc1-4f2a4e5ecca3@googlegroups.com> |
| In reply to | #60328 |
polymorphism what big word...
[toc] | [prev] | [next] | [standalone]
| From | asetofsymbols@gmail.com |
|---|---|
| Date | 2015-04-18 11:52 -0700 |
| Message-ID | <ed6b431b-c882-45b2-9d56-ff9d0ab620af@googlegroups.com> |
| In reply to | #60329 |
I foR OO I mean: Compiler emit code for Automatic creation, resize, destruction, of one object Possibly even choose the right function for apply but that would be overloading... All this is important the remain return 0
[toc] | [prev] | [next] | [standalone]
| From | Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> |
|---|---|
| Date | 2015-04-18 19:02 +0000 |
| Message-ID | <mgu9oa$4nk$1@news.albasani.net> |
| In reply to | #60328 |
On Sat, 18 Apr 2015 10:26:32 -0700, David Kleinecke wrote: > After all these years uncertainty still reigns about what > object-oriented computing is all about. It was supposed to be a silver bullet - you know, solve all possible programming issues, make code clean, clear and easy to understand, prevent people from reinventing the wheel, give you fresh, minty breath, make you irresistible to desirable members of your selected sex, the works. Reality put it in its place - good for some undertakings (e.g. graphics) but just another paradigm for the rest. Some people swear by it; just as many hate it with passion.
[toc] | [prev] | [next] | [standalone]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Date | 2015-04-18 15:08 -0500 |
| Message-ID | <mgudri$cdv$1@news.albasani.net> |
| In reply to | #60338 |
On 4/18/2015 2:02 PM, Jens Stuckelberger wrote:
> On Sat, 18 Apr 2015 10:26:32 -0700, David Kleinecke wrote:
>
>> After all these years uncertainty still reigns about what
>> object-oriented computing is all about.
>
> It was supposed to be a silver bullet - you know, solve all
> possible programming issues, make code clean, clear and easy to
> understand, prevent people from reinventing the wheel, give you fresh,
> minty breath, make you irresistible to desirable members of your selected
> sex, the works.
>
> Reality put it in its place - good for some undertakings (e.g.
> graphics) but just another paradigm for the rest. Some people swear by
> it; just as many hate it with passion.
>
and other people swear by "OO languages", taking Java as a golden
example, yet there is little really in Java on this front that can't be
done in C with structs and function-pointers (yes, including things like
interfaces and 'instanceof' and similar...).
of course, a nicer model for mapping OO to C is doing it more like in
Common Lisp, but then people object that this is not OO, as:
BaseClass_DoSomething(obj, ...);
doesn't really look anything like:
obj.doSomething(...);
or:
obj->DoSomething(...);
as, this pretty much just looks like normal C code (and internally
usually just forwards the call to the appropriate vtable entry).
other differences is people can balk when you do your interfaces like:
IFoo **foo;
foo=&obj->iFoo;
(*foo)->DoSomething(...);
rather than something like:
IFoo foo;
foo=(IFoo)obj;
foo.doSomething(...);
of course, what may be overlooked, is that structs and function pointers
allow doing a lot of things, and a lot more efficiently, that would be a
bit ugly and awkward if shoved into the traditional class/instance OO mold.
[toc] | [prev] | [next] | [standalone]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Date | 2015-04-18 16:46 -0500 |
| Message-ID | <mguji8$lnf$1@news.albasani.net> |
| In reply to | #60344 |
On 4/18/2015 3:17 PM, Stefan Ram wrote: > BGB <cr88192@hotmail.com> writes: >> and other people swear by "OO languages", taking Java as a golden >> example, yet there is little really in Java on this front that can't be >> done in C with structs and function-pointers (yes, including things like >> interfaces and 'instanceof' and similar...). > > You can also »do« classes and interfaces in 6502 assembler, > but in Java it's more easier to read and write. > if a person wants to object to a language under the premise that OO stuff can't be done in it, it falls flat if OO stuff *can* be done in it. meanwhile, old-style strictly procedural code is by no means a necessity, and if code is written this way, typically it is because it is a better fit to the use-case. >> of course, a nicer model for mapping OO to C is doing it more like in >> Common Lisp, but then people object that this is not OO, as: > > Alan Kay, who coined the term, wrote about OOP: > > »It can be done in Smalltalk and in LISP. There are > possibly other systems in which this is possible, but > I'm not aware of them.«. > and Lisp OO is very much different than C++ or Java style OO.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-04-18 15:41 -0700 |
| Message-ID | <87twwdoy91.fsf@kst-u.example.com> |
| In reply to | #60328 |
David Kleinecke <dkleinecke@gmail.com> writes:
> After all these years uncertainty still reigns about what
> object-oriented computing is all about. I have my own opinions
> and this groups seems like a good place to present my techniques
> and, perhaps, get some useful feedback.
>
> I consider objects a good way to organize processes. I also
> prefer to code in C. By C I mean 1990 ANSI C.
What's wrong with the later standards?
> By "class" I mean a pair of a struct type and a function. I
> would define them both in a .h file along with an optional
> enum. An object of the class is a variable of the struct type.
>
> Suppose I want to use foobar objects. To do this I declare
>
> typedef struct {...} FooBar;
> void* foobar (int m, void* o, void* d);
>
> where m is a method number (perhaps defined by an enum), o
> is variable of type FooBar and d is additional data.
*Perhaps* defined by an enum?
> I prefer to clone variables. So I could call method 0 the
> clone method and write
>
> FooBar* fb = foobar (0, 0, 0);
>
> Where cloning 0 creates a default FooBar object.
So I have to remember that 0 means "clone" to be able to read your code?
No thanks.
> To inherit I just make a call to a parent class. To multiply
> inherit it is necessary to change the method numbers to
> inherit from all but one of the parent classes.
>
> Some things people insist on - like polymorphism - seem to
> me perhaps useful but easy to get along without.
>
> Reactions ?
>
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | August Karlstrom <fusionfile@gmail.com> |
|---|---|
| Date | 2015-04-19 11:48 +0200 |
| Message-ID | <mgvtl1$du$1@speranza.aioe.org> |
| In reply to | #60354 |
On 2015-04-19 00:41, Keith Thompson wrote: > David Kleinecke <dkleinecke@gmail.com> writes: >> After all these years uncertainty still reigns about what >> object-oriented computing is all about. I have my own opinions >> and this groups seems like a good place to present my techniques >> and, perhaps, get some useful feedback. >> >> I consider objects a good way to organize processes. I also >> prefer to code in C. By C I mean 1990 ANSI C. > > What's wrong with the later standards? The curse of backward compatibility which makes a language grow and grow. -- August
[toc] | [prev] | [next] | [standalone]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Date | 2015-04-19 09:32 -0500 |
| Message-ID | <mh0eg9$bhf$1@news.albasani.net> |
| In reply to | #60376 |
On 4/19/2015 4:48 AM, August Karlstrom wrote: > On 2015-04-19 00:41, Keith Thompson wrote: >> David Kleinecke <dkleinecke@gmail.com> writes: >>> After all these years uncertainty still reigns about what >>> object-oriented computing is all about. I have my own opinions >>> and this groups seems like a good place to present my techniques >>> and, perhaps, get some useful feedback. >>> >>> I consider objects a good way to organize processes. I also >>> prefer to code in C. By C I mean 1990 ANSI C. >> >> What's wrong with the later standards? > > The curse of backward compatibility which makes a language grow and grow. > also, a lot of compilers never bothered (fully) supporting anything newer than C89/C90. > > -- August
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-04-19 07:55 -0700 |
| Message-ID | <87d230p3pm.fsf@kst-u.example.com> |
| In reply to | #60376 |
August Karlstrom <fusionfile@gmail.com> writes:
> On 2015-04-19 00:41, Keith Thompson wrote:
>> David Kleinecke <dkleinecke@gmail.com> writes:
>>> After all these years uncertainty still reigns about what
>>> object-oriented computing is all about. I have my own opinions
>>> and this groups seems like a good place to present my techniques
>>> and, perhaps, get some useful feedback.
>>>
>>> I consider objects a good way to organize processes. I also
>>> prefer to code in C. By C I mean 1990 ANSI C.
>>
>> What's wrong with the later standards?
>
> The curse of backward compatibility which makes a language grow and grow.
That wasn't meant to be a general question about what's wrong with C99
and C11 (that's way too big a topic, or perhaps one for its own thread).
I was specifically asking about David Kleinecke's objections.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-04-19 09:27 -0700 |
| Message-ID | <334bd7cb-9ae3-4845-bec3-3a345fa24a27@googlegroups.com> |
| In reply to | #60416 |
On Sunday, April 19, 2015 at 7:56:00 AM UTC-7, Keith Thompson wrote: > August Karlstrom <fusionfile@gmail.com> writes: > > On 2015-04-19 00:41, Keith Thompson wrote: > >> David Kleinecke <dkleinecke@gmail.com> writes: > >>> After all these years uncertainty still reigns about what > >>> object-oriented computing is all about. I have my own opinions > >>> and this groups seems like a good place to present my techniques > >>> and, perhaps, get some useful feedback. > >>> > >>> I consider objects a good way to organize processes. I also > >>> prefer to code in C. By C I mean 1990 ANSI C. > >> > >> What's wrong with the later standards? > > > > The curse of backward compatibility which makes a language grow and grow. > > That wasn't meant to be a general question about what's wrong with C99 > and C11 (that's way too big a topic, or perhaps one for its own thread). > I was specifically asking about David Kleinecke's objections. > > -- > Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> > Working, but not speaking, for JetHead Development, Inc. > "We must do something. This is something. Therefore, we must do this." > -- Antony Jay and Jonathan Lynn, "Yes Minister" I prefer simplicity. Only one of the "improvements" made after 1990 C seems be actually useful if simplicity is a design criterion. That change is allowing declarations to be made where they actually used rather than at the start of the block. That is, of course, close to trivial. I would rather code in assembly language but I realize, for all the usual reasons, that that is not currently realistic. Perhaps some day when we all agree on a single hardware design. In my code I further simplify by never using "for" or "do .. while". And I never put more than one statement on a line. So - if I am no exposing the code I don't write semicolons, braces or parentheses in "if" etc. Adding them is no problem. Bottom line: I don't object to the changes in the 1990 standard - I just feel no need for them.
[toc] | [prev] | [next] | [standalone]
| From | Johannes Bauer <dfnsonfsduifb@gmx.de> |
|---|---|
| Date | 2015-04-19 20:52 +0200 |
| Message-ID | <mh0th1$8an$1@news.albasani.net> |
| In reply to | #60428 |
On 19.04.2015 18:27, David Kleinecke wrote: > I would rather code in assembly language but I realize, for all the usual > reasons, that that is not currently realistic. Perhaps some day when we all > agree on a single hardware design. Are you joking or actually mean what you say? You invent a (poor) OO layer on top of C to *increase* abstaction, but what you actually would want is to code in assembly, i.e. significantly *decrease* abstraction? How does that make any sense at all? And in what phantasy world do you live in that you think we will all "agree" on a single hardware design somewhen in the future? > In my code I further simplify by never using "for" or "do .. while". What? You sound like a horrible programmer. I'm dead serious. You avoid the most basic language constructs because you want to "simplify"? Do you realize that this will create an enormous burden on everyone who reads your code? Everyone who just expects certain problems to be solved in a quasi-standard approach? Sure, no need for fors or do/whiles. None at all, not necessary to have a turing complete language. But that's a damn weird subset of C that you're using. > And > I never put more than one statement on a line. This is the only thing in your entire post that sounds sensible. > Bottom line: I don't object to the changes in the 1990 standard - I just > feel no need for them. Bottom line: I've saved a bullet here that I will shoot in my head if I ever end up in a position where I need to maintain your code. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org>
[toc] | [prev] | [next] | [standalone]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Date | 2015-04-19 16:01 -0500 |
| Message-ID | <mh159o$m9o$1@news.albasani.net> |
| In reply to | #60448 |
On 4/19/2015 1:52 PM, Johannes Bauer wrote: > On 19.04.2015 18:27, David Kleinecke wrote: > >> I would rather code in assembly language but I realize, for all the usual >> reasons, that that is not currently realistic. Perhaps some day when we all >> agree on a single hardware design. > > Are you joking or actually mean what you say? You invent a (poor) OO > layer on top of C to *increase* abstaction, but what you actually would > want is to code in assembly, i.e. significantly *decrease* abstraction? > How does that make any sense at all? > > And in what phantasy world do you live in that you think we will all > "agree" on a single hardware design somewhen in the future? > ... turns into an epic battle between various embedded ISAs, and also contenders like x86. eventual winner ends up being a 64-bit extended version of the 6502, which is in effect just a normal 8-bit 6502 with an ability to map part of its address space to an larger external cache, which may in turn be configured to map piecewise into an external 64-bit address space. this in turn having been a compromise between the desktop PC people wanting a 64-bit address space, and the small embedded people not wanting processor cores which cost them more than $0.05 per unit... big conflicts regularly turn up as to the exact contents of the "System ROM", as its small size means only certain functionality can be included, and its specific contents and layout are critical for the correct operation of code produced by application-level C compilers (which end up needing to rely on its services for things like addressing memory, making function calls, or performing arithmetic operations). >> In my code I further simplify by never using "for" or "do .. while". > > What? You sound like a horrible programmer. I'm dead serious. > > You avoid the most basic language constructs because you want to > "simplify"? Do you realize that this will create an enormous burden on > everyone who reads your code? Everyone who just expects certain problems > to be solved in a quasi-standard approach? > > Sure, no need for fors or do/whiles. None at all, not necessary to have > a turing complete language. But that's a damn weird subset of C that > you're using. > though, FWIW, "do ... while()" is often less commonly used IME than "for()" or the normal "while()". >> And >> I never put more than one statement on a line. > > This is the only thing in your entire post that sounds sensible. > ... but, why not write code paragraph style? the word-wrap setting feels so alone and neglected. ... >> Bottom line: I don't object to the changes in the 1990 standard - I just >> feel no need for them. > > Bottom line: I've saved a bullet here that I will shoot in my head if I > ever end up in a position where I need to maintain your code. > FWIW, in my case I mostly stick with C90, but mostly it is because I compile a lot of my code using MSVC. though, they do at least support '//' and 'long long'.
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-04-20 10:50 -0700 |
| Message-ID | <068921f0-37f5-41d2-a7e0-e12528fe5f1a@googlegroups.com> |
| In reply to | #60448 |
On Sunday, April 19, 2015 at 11:52:30 AM UTC-7, Johannes Bauer wrote: > On 19.04.2015 18:27, David Kleinecke wrote: > > > I would rather code in assembly language but I realize, for all the usual > > reasons, that that is not currently realistic. Perhaps some day when we all > > agree on a single hardware design. > > Are you joking or actually mean what you say? You invent a (poor) OO > layer on top of C to *increase* abstaction, but what you actually would > want is to code in assembly, i.e. significantly *decrease* abstraction? > How does that make any sense at all? > > And in what phantasy world do you live in that you think we will all > "agree" on a single hardware design somewhen in the future? > > > In my code I further simplify by never using "for" or "do .. while". > > What? You sound like a horrible programmer. I'm dead serious. > > You avoid the most basic language constructs because you want to > "simplify"? Do you realize that this will create an enormous burden on > everyone who reads your code? Everyone who just expects certain problems > to be solved in a quasi-standard approach? > > Sure, no need for fors or do/whiles. None at all, not necessary to have > a turing complete language. But that's a damn weird subset of C that > you're using. > > > And > > I never put more than one statement on a line. > > This is the only thing in your entire post that sounds sensible. > > > Bottom line: I don't object to the changes in the 1990 standard - I just > > feel no need for them. > > Bottom line: I've saved a bullet here that I will shoot in my head if I > ever end up in a position where I need to maintain your code. > > Cheers, > Johannes > > -- > >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > > Zumindest nicht öffentlich! > Ah, der neueste und bis heute genialste Streich unsere großen > Kosmologen: Die Geheim-Vorhersage. > - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org> In the long run innovation in computing will cease. We will all agree on all the acceptable ways to do everything. Programming will be like Lego - put together standard blocks. All the hardware will have the same architecture. A handful of researchers will continue to scan the standard codes and grub out the remaining bugs (I am not optimistic that we will ever get our software bug-free). I hope that by this time all the code I wrote for actual applications has been retired and you will not be forced to maintain it. These days I code for amusement and the grasp of general principles.
[toc] | [prev] | [next] | [standalone]
| From | Johannes Bauer <dfnsonfsduifb@gmx.de> |
|---|---|
| Date | 2015-04-20 22:49 +0200 |
| Message-ID | <mh3oog$kta$2@news.albasani.net> |
| In reply to | #60545 |
On 20.04.2015 19:50, David Kleinecke wrote: > I hope that by this time all the code I wrote for actual applications has > been retired and you will not be forced to maintain it. Eventually one thing that we both can strongly agree on. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org>
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-04-19 13:54 -0700 |
| Message-ID | <87wq17on3e.fsf@kst-u.example.com> |
| In reply to | #60428 |
David Kleinecke <dkleinecke@gmail.com> writes:
[...]
> I would rather code in assembly language but I realize, for all the usual
> reasons, that that is not currently realistic. Perhaps some day when we all
> agree on a single hardware design.
[...]
Your preferences differ substantially from mine.
(Johannes Bauer: See, this is how you disagree with someone without
being insulting.)
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Johannes Bauer <dfnsonfsduifb@gmx.de> |
|---|---|
| Date | 2015-04-19 23:05 +0200 |
| Message-ID | <mh15a0$mbs$1@news.albasani.net> |
| In reply to | #60457 |
On 19.04.2015 22:54, Keith Thompson wrote: > Your preferences differ substantially from mine. > > (Johannes Bauer: See, this is how you disagree with someone without > being insulting.) Your opinion on what constitutes an insult differs substantially from mine. Telling someone they sound like a horrible programmer is not an insult, it is just the harsh truth. To me, David sounds like someone with an incredible distortion in perceiving what constitutes good code. I would expect people to believe the same of my programming skills if I'd blatantly ignore tons of best practices that have crystallized over the years. And while it is your prerogative to sugarcoat the worst of programming practices, I choose to not sugarcoat. There's a significant difference to an insult, mind you. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org>
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-04-20 10:53 -0700 |
| Message-ID | <93498d87-c8a1-4546-9176-385190b28b7e@googlegroups.com> |
| In reply to | #60458 |
On Sunday, April 19, 2015 at 2:05:11 PM UTC-7, Johannes Bauer wrote: > On 19.04.2015 22:54, Keith Thompson wrote: > > > Your preferences differ substantially from mine. > > > > (Johannes Bauer: See, this is how you disagree with someone without > > being insulting.) > > Your opinion on what constitutes an insult differs substantially from mine. > > Telling someone they sound like a horrible programmer is not an insult, > it is just the harsh truth. To me, David sounds like someone with an > incredible distortion in perceiving what constitutes good code. I would > expect people to believe the same of my programming skills if I'd > blatantly ignore tons of best practices that have crystallized over the > years. > > And while it is your prerogative to sugarcoat the worst of programming > practices, I choose to not sugarcoat. There's a significant difference > to an insult, mind you. > > Cheers, > Johannes > > -- > >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > > Zumindest nicht öffentlich! > Ah, der neueste und bis heute genialste Streich unsere großen > Kosmologen: Die Geheim-Vorhersage. > - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org> You don't bother me. I've met lots of opinionated people.
[toc] | [prev] | [next] | [standalone]
| From | Johannes Bauer <dfnsonfsduifb@gmx.de> |
|---|---|
| Date | 2015-04-20 22:47 +0200 |
| Message-ID | <mh3olh$kta$1@news.albasani.net> |
| In reply to | #60546 |
On 20.04.2015 19:53, David Kleinecke wrote: > You don't bother me. I've met lots of opinionated people. Yeah, I didn't really expect you to adress any issues that I raised. People who think they have created a marvel by reinventing the wheel in a crappy way usually aren't impressed by objections. Happy coding, Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org>
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-04-19 10:14 -0700 |
| Message-ID | <95f1e7b7-8a00-4afe-a29e-e888756de72d@googlegroups.com> |
| In reply to | #60354 |
On Saturday, April 18, 2015 at 3:41:49 PM UTC-7, Keith Thompson wrote:
> David Kleinecke <dkleinecke@gmail.com> writes:
> > After all these years uncertainty still reigns about what
> > object-oriented computing is all about. I have my own opinions
> > and this groups seems like a good place to present my techniques
> > and, perhaps, get some useful feedback.
> >
> > I consider objects a good way to organize processes. I also
> > prefer to code in C. By C I mean 1990 ANSI C.
>
> What's wrong with the later standards?
>
> > By "class" I mean a pair of a struct type and a function. I
> > would define them both in a .h file along with an optional
> > enum. An object of the class is a variable of the struct type.
> >
> > Suppose I want to use foobar objects. To do this I declare
> >
> > typedef struct {...} FooBar;
> > void* foobar (int m, void* o, void* d);
> >
> > where m is a method number (perhaps defined by an enum), o
> > is variable of type FooBar and d is additional data.
>
> *Perhaps* defined by an enum?
>
> > I prefer to clone variables. So I could call method 0 the
> > clone method and write
> >
> > FooBar* fb = foobar (0, 0, 0);
> >
> > Where cloning 0 creates a default FooBar object.
>
> So I have to remember that 0 means "clone" to be able to read your code?
> No thanks.
>
> > To inherit I just make a call to a parent class. To multiply
> > inherit it is necessary to change the method numbers to
> > inherit from all but one of the parent classes.
> >
> > Some things people insist on - like polymorphism - seem to
> > me perhaps useful but easy to get along without.
> >
> > Reactions ?
> >
>
> --
> Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
> Working, but not speaking, for JetHead Development, Inc.
> "We must do something. This is something. Therefore, we must do this."
> -- Antony Jay and Jonathan Lynn, "Yes Minister"
You answered your own question about enums. If you don't want to
remember 0 means CLONE use an enum. I find it just as easy to put the
code table in the comments.
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.c
csiph-web