All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Powertop] Why C++ is the language of implementation?
@ 2014-03-31 15:48 Arjan van de Ven
  0 siblings, 0 replies; 6+ messages in thread
From: Arjan van de Ven @ 2014-03-31 15:48 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

On 3/31/2014 8:43 AM, Bill Vyzas wrote:
> Hi all,
>
> I am curious to know why PowerTOP is using C++ as the language of implementation but the majority of the program is written with the C standards. I checked also some other
> open source programs like the Gnome Power Manager and its doing the same thing.
>
> I know that C++ can also call C and I also know that there are couple of classes on the program but why use C++ for a few classes when you can have structs, which are
> basically classes, instead.


C++ and objects are a very useful paradigm for certain things (especially if they map
to actual physical things)... and powertop uses that.

I'm not one of those people who goes overboard and sees objects for things that are not
really objects, just pieces of data.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Powertop] Why C++ is the language of implementation?
@ 2014-03-31 16:05 Srinivas Pandruvada
  0 siblings, 0 replies; 6+ messages in thread
From: Srinivas Pandruvada @ 2014-03-31 16:05 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]

On 03/31/2014 08:43 AM, Bill Vyzas wrote:
> Hi all,
>
> I am curious to know why PowerTOP is using C++ as the language of
> implementation but the majority of the program is written with the C
> standards. I checked also some other open source programs like the Gnome
> Power Manager and its doing the same thing.
>
> I know that C++ can also call C and I also know that there are couple of
> classes on the program but why use C++ for a few classes when you can have
> structs, which are basically classes, instead.
It is because of ease of implementation using inheritance and polymorphism.
For example you can have a common device class and other device CPUs are
expanding the capability of a basic device. Also for common code all 
objects are
devices, if it happens to be a CPU, then cpu specific methods can be called.
Also it provides a very easy path for enhancements, without touching the 
core
functionality.
You can do in C with struct and function pointers, but implementing in 
C++ is easy.

Thanks,
Srinivas

> Thanks,
> Bill
>
>
>
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop


[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 2086 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Powertop] Why C++ is the language of implementation?
@ 2014-03-31 16:01 Bill Vyzas
  0 siblings, 0 replies; 6+ messages in thread
From: Bill Vyzas @ 2014-03-31 16:01 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

That sounds reasonable but why not use pure C++ instead of some parts with
classes and some with the C standards?

Thanks


On 31 March 2014 16:55, Arjan van de Ven <arjan(a)linux.intel.com> wrote:

> On 3/31/2014 8:54 AM, Bill Vyzas wrote:
>
>> What the physical things will be in the case of powertop? Are we talking
>> about device drivers and cpu measurements?
>>
>
> powertop builds a power model of the devices in your computer, from fans
> to USB devices to CPU to ...
> you name it.
> to model those, it uses C++ style objects in a class hierarchy
>
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 1018 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Powertop] Why C++ is the language of implementation?
@ 2014-03-31 15:55 Arjan van de Ven
  0 siblings, 0 replies; 6+ messages in thread
From: Arjan van de Ven @ 2014-03-31 15:55 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 345 bytes --]

On 3/31/2014 8:54 AM, Bill Vyzas wrote:
> What the physical things will be in the case of powertop? Are we talking about device drivers and cpu measurements?

powertop builds a power model of the devices in your computer, from fans to USB devices to CPU to ...
you name it.
to model those, it uses C++ style objects in a class hierarchy


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Powertop] Why C++ is the language of implementation?
@ 2014-03-31 15:54 Bill Vyzas
  0 siblings, 0 replies; 6+ messages in thread
From: Bill Vyzas @ 2014-03-31 15:54 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

What the physical things will be in the case of powertop? Are we talking
about device drivers and cpu measurements?

Thanks


On 31 March 2014 16:48, Arjan van de Ven <arjan(a)linux.intel.com> wrote:

> On 3/31/2014 8:43 AM, Bill Vyzas wrote:
>
>> Hi all,
>>
>> I am curious to know why PowerTOP is using C++ as the language of
>> implementation but the majority of the program is written with the C
>> standards. I checked also some other
>> open source programs like the Gnome Power Manager and its doing the same
>> thing.
>>
>> I know that C++ can also call C and I also know that there are couple of
>> classes on the program but why use C++ for a few classes when you can have
>> structs, which are
>> basically classes, instead.
>>
>
>
> C++ and objects are a very useful paradigm for certain things (especially
> if they map
> to actual physical things)... and powertop uses that.
>
> I'm not one of those people who goes overboard and sees objects for things
> that are not
> really objects, just pieces of data.
>
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 1520 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Powertop] Why C++ is the language of implementation?
@ 2014-03-31 15:43 Bill Vyzas
  0 siblings, 0 replies; 6+ messages in thread
From: Bill Vyzas @ 2014-03-31 15:43 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

Hi all,

I am curious to know why PowerTOP is using C++ as the language of
implementation but the majority of the program is written with the C
standards. I checked also some other open source programs like the Gnome
Power Manager and its doing the same thing.

I know that C++ can also call C and I also know that there are couple of
classes on the program but why use C++ for a few classes when you can have
structs, which are basically classes, instead.

Thanks,
Bill

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 565 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-03-31 16:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-31 15:48 [Powertop] Why C++ is the language of implementation? Arjan van de Ven
  -- strict thread matches above, loose matches on Subject: below --
2014-03-31 16:05 Srinivas Pandruvada
2014-03-31 16:01 Bill Vyzas
2014-03-31 15:55 Arjan van de Ven
2014-03-31 15:54 Bill Vyzas
2014-03-31 15:43 Bill Vyzas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.