User Profile

Collapse

Profile Sidebar

Collapse
pnayak
pnayak
Last Activity: May 9 '12, 06:44 PM
Joined: Apr 22 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • pnayak
    started a topic looser throw specifier in gcc 4.0.1
    in C

    looser throw specifier in gcc 4.0.1

    Hi All,

    Compiling the code below should result in the "looser throw specifier" error from the gcc compiler. It does give me that error if I un-comment the destructor in the derived class. But the default destructor created by the compiler should will be essentially the same. So I'm wondering why this compiles.
    Code:
    #include <iostream>
    
    class Base {
        public:        Base()  { std::cout
    ...
    See more | Go to post

  • pnayak
    started a topic ofstream/ostream flush() error check
    in C

    ofstream/ostream flush() error check

    Is this method of checking, if flush() succeeded or failed, valid?

    Code:
    std::ofstream ofs;
    file.open("test.txt")
    
    file << "line of text";
    
    if (!ofs.flush()) {
        std::cout << " failed to write \n ";
        return 1;
    }
    See more | Go to post

  • That's the same paper from which I was testing the conclusion. The entire paper is about comparing the the two types on performance and flexibility. But according to you they are not equivalent and comparing them makes no sense!

    You should also read The C++ Programming Language by Stroustrup [16.2]. That will give you a better understanding of the concepts involved.

    Here are a few of lines from the papers abstract....
    See more | Go to post

    Leave a comment:


  • I completely disagree.

    The choice of intrusive and non-intrusive lists with regards to performance and flexibility is very important in Container design and form a fairly large part of any literature that deals with the topic. Their comparison is very important and makes a lot of sense.
    See more | Go to post

    Leave a comment:


  • pnayak
    replied to Iterator Implementation Compile error
    in C
    I tried on another box with a 4.2 version of gcc and same problem. However the Error message in this case is,

    nList.cc:50: error: type 'nList<T>' is not derived from type 'List_Iterator< T>'
    nList.cc:50: error: expected ';' before 'current_'
    See more | Go to post

    Leave a comment:


  • pnayak
    started a topic Iterator Implementation Compile error
    in C

    Iterator Implementation Compile error

    Hi,

    I am trying to implement an iterator to a List class. The code is included below. I get the following compiler error. At the point where I use a class that is defined inside a template (nList<T>::Link ). The Link class is defined inside of a template. (I assume that is possible?). Any one know what I doing wrong?

    Many Thanks,
    Purush

    Error from Compiler (gcc 3.4.6)
    nList.cc:52: error:...
    See more | Go to post
    Last edited by pnayak; Apr 25 '08, 03:17 AM. Reason: more explanation

  • That's a nice point, however, what I am trying to do here is to develop an intrusive list and not a non-intrusive list, which is what you are describing. One way of developing an intrusive list it to use the Link object as a member of the application class. The other option is to make the Link a common base class.

    I am trying to ascertain whether intrusive lists have better performance as opposed to non-intrusive lists since the ...
    See more | Go to post

    Leave a comment:


  • OH MY HOLY GOD. You are right.

    I wasted an entire evening on this. I pretty much tore apart the c++ template vocabulary to understand this "obscure" behavior. Turned out to be a semi colon !!!!.

    Thank you so much.
    Purush
    See more | Go to post

    Leave a comment:


  • Instrusive List Container using the Base class as the node

    Hi,

    I am trying to write an intrusive List template class that accepts any type that is derived from a class called Link. I've derived a class called Student from Link to experiment. When I use the Link and Student class without List they work very well but when I used them through the List class the new operator doesn't throw but seems to be return 0.

    I've pasted the full code here and the program output. The commented...
    See more | Go to post
    Last edited by Ganon11; Apr 25 '08, 09:21 PM. Reason: Please use the [CODE] tags provided, rather than [INDENT] tags.
No activity results to display
Show More
Working...