Linux.com

Noluk

Noluk

  • Linux.com Member
  • Posts: 9
  • Member Since: 16 Feb 10
  • Last Logged In: 02 Nov 11

Latest Posts

Posted by
Topic
Post Preview
Posted
  • Noluk
    RE: Am I C-ing this right?
    That helps; thank you for the insight.
    Link to this post 16 May 11

    That helps; thank you for the insight.

  • Noluk
    RE: Am I C-ing this right?
    [b]Marc Deop[/b] wrote: [quote]They write in C because it's *faster* [/quote] What sort of [rough guide] figure would apply to that? Would that still be true in the following event: [b]Rubberman[/b] wrote: [quote] It may be possible to write kernel modules in C++, but it would be so restricted that it would end up pretty much just C code. [/quote] That is to say: Does the C code always compile to faster, more efficient machine code than C++ ?
    Link to this post 14 May 11

    Marc Deop wrote:

    They write in C because it's *faster*

    What sort of [rough guide] figure would apply to that?
    Would that still be true in the following event:

    Rubberman wrote:


    It may be possible to write kernel modules in C++, but it would be so restricted that it would end up pretty much just C code.

    That is to say:
    Does the C code always compile to faster, more efficient machine code than C++ ?

  • Noluk
    RE: Am I C-ing this right?
    Thanks for your feedback. However, to elaborate a bit more, my thoughts were that: as [far as I could see] the Kernel writers continue to write it just in C, and they presumably do so because they regard it to be better than C++ and so shouldn't I just follow their lead and not bother with continuing to try to learn C++? If it's not: [arguably] better than C++ (and your replies suggest to me that it is not), then whatever are their reasons for continuing/[prefering] to write it in C?
    Link to this post 12 May 11

    Thanks for your feedback.

    However, to elaborate a bit more, my thoughts were that:
    as [far as I could see] the Kernel writers continue to write it just in C, and they presumably do so because they regard it to be better than C++
    and so shouldn't I just follow their lead and not bother with continuing to try to learn C++?

    If it's not: [arguably] better than C++ (and your replies suggest to me that it is not), then whatever are their reasons for continuing/[prefering] to write it in C?

  • Noluk
    Am I C-ing this right?
    Hello. I've just realised that all the headers mentioned in the Manpages are of style: something.h From what I've been reading, I gather that they are all therefore C headers. Am I correct? If so, then what is the merit as an [exclusivley] Linux user in my learning C++?
    Link to this post 09 May 11

    Hello.

    I've just realised that all the headers mentioned in the Manpages are of style: something.h
    From what I've been reading, I gather that they are all therefore C headers.

    Am I correct?
    If so, then what is the merit as an [exclusivley] Linux user in my learning C++?

  • Noluk
    RE: Virtually endless precision (C++ query)
    the answer is [url=http://forums.debian.net/viewtopic.php?f=8&t=49627] here [/url]
    Link to this post 15 Mar 10

    the answer is here

  • Noluk
    RE: Virtually endless precision (C++ query)
    But, Rubberman, the displayed digits are correct ! [as far as I can tell]. size of d is 4 bytes, the print-out is 39 digits.
    Link to this post 19 Feb 10

    But, Rubberman, the displayed digits are correct ! [as far as I can tell].
    size of d is 4 bytes, the print-out is 39 digits.

  • Noluk
    Virtually endless precision (C++ query)
    I am new to C++ using GCC but the following program (print-out) gives very much more precision than the number of bytes allocated to a variable of (eg type float) 4 bytes ought to give and errno is always 0. Can anyone enlighten me as to why, please? [code] using namespace std; #include #include int main () { cout.precision(9999); float d=1; // 4bytes type - set i to 129 - result is 39 digits (:-o // or try :- //double d=1; // 8bytes type - set i to 1025 - 308 digits (:-O // or try :- //long double d=1; // 12bytes type - set i to 16385, - fails at i=16384 - 4932 digits? =(:-O for (int i=1; i<129; i++) { d=d*2; cout<<"err="<
    Link to this post 17 Feb 10

    I am new to C++ using GCC but the following program (print-out) gives very much more precision than the number of bytes allocated to a variable of (eg type float) 4 bytes ought to give and errno is always 0. Can anyone enlighten me as to why, please?


    using namespace std;
    #include <iostream>
    #include <errno.h>
    int main () {
    cout.precision(9999);
    float d=1; // 4bytes type - set i to 129 - result is 39 digits (:-o
    // or try :-
    //double d=1; // 8bytes type - set i to 1025 - 308 digits (:-O
    // or try :-
    //long double d=1; // 12bytes type - set i to 16385, - fails at i=16384 - 4932 digits? =(:-O
    for (int i=1; i<129; i++) { d=d*2; cout<<"err="<<errno<<"\ti="<<i<<"\t"<<d<<"\n"; }
    cout<<"\n"<< sizeof(d) <<" bytes is sizeof d\n\n";
    return 0;}

    [BTW:- how would i have inserted that as an image?]

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board