All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada at linux.intel.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] Why C++ is the language of implementation?
Date: Mon, 31 Mar 2014 09:05:37 -0700	[thread overview]
Message-ID: <53399251.9050903@linux.intel.com> (raw)
In-Reply-To: CADy9ZNA_1wW69nyNNS=yqL0iqoWZZB=UiTt2BCkft=nqwZP5Sg@mail.gmail.com

[-- 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 --]

             reply	other threads:[~2014-03-31 16:05 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53399251.9050903@linux.intel.com \
    --to=powertop@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.