Topic: templates vs. macros
Author: postmast.root.admi.gov@iname.com (blargg)
Date: 1999/08/18 Raw View
In article <p6qk8qwnmcy.fsf@informatik.hu-berlin.de>, Martin von Loewis
<loewis@informatik.hu-berlin.de> wrote:
> Lucas Vogel <lucas7@home.com> writes:
>
> > Yet from what I see ( or I THINK I see-could be wrong on this ), I
> > don't see anyone using the template technique in Linux, only very
> > extensive usage of macros. Macros seem to be set all over the place,
> > for just about everything.
>
> When you say Linux, do you mean the Linux *kernel*?
>
> > Is this observation correct, and if so, why?
>
> Because the Linux kernel is written in C, not C++, and because C does
> not support templates.
And the reason for this? Unfamiliarity? Ignorance of C++? Non-appreciation
of the utility of C++, even of minimalist "C with classes" C++?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Lucas Vogel <lucas7@home.com>
Date: 1999/08/16 Raw View
I am reading a C++ textbook of mine ( Object Oriented Programming in C++
by
Robert LaFore, cp. 1995 ) , and there is a chapter on the incorporation
of the use of templates into the C++ language. In the chapter that he
talks about templates vs. macros to create different versions of a
function for different datatypes. Yet from what I see ( or I THINK I
see-could be wrong on this ), I don't see anyone using the template
technique in Linux, only very extensive usage of macros. Macros seem to
be set all over the place, for just about everything.
Is this observation correct, and if so, why?
--
--------------------------------------------
Lucas Vogel
Brought to you by Caldera OpenLinux 2.2!
--------------------------------------------
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Greg Brewer" <nospam.gregb@hal-pc.org>
Date: 1999/08/16 Raw View
Lucas Vogel <lucas7@home.com> wrote in message
news:37B678ED.24F0E5E6@home.com...
> I am reading a C++ textbook of mine ( Object Oriented Programming in C++
> by
> function for different datatypes. Yet from what I see ( or I THINK I
> see-could be wrong on this ), I don't see anyone using the template
> technique in Linux, only very extensive usage of macros. Macros seem to
> be set all over the place, for just about everything.
>
> Is this observation correct, and if so, why?
The problem with templates is that they are not supported in C. I expect
that you are probably looking in header files and the header files were
probably designed to be included in C programs. Sometimes, header files
will be coded for C++ or C but I have found this to be rare.
Greg Brewer
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Martin von Loewis <loewis@informatik.hu-berlin.de>
Date: 1999/08/17 Raw View
Lucas Vogel <lucas7@home.com> writes:
> Yet from what I see ( or I THINK I see-could be wrong on this ), I
> don't see anyone using the template technique in Linux, only very
> extensive usage of macros. Macros seem to be set all over the place,
> for just about everything.
When you say Linux, do you mean the Linux *kernel*?
> Is this observation correct, and if so, why?
Because the Linux kernel is written in C, not C++, and because C does
not support templates.
Regards,
Martin
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]