Re: problem with linklist
Erik Wikstr?m <Erik-wikstrom@telia.com> wrote in news:I69ji.3524$ZA.1535
@newsb.telia.net:
On 2007-07-05 17:12, sunilsomanna@gmail.com wrote:
template<class T>
void TimerDLList<T>::addFirst(TimerItem<T>* const itemPtr)
{
// suppose itemPtr is not pointing to NULL
itemPtr->prev = (TimerItem<T>*) NULL;
head = (TimerItem<T>*)NULL;
if (tail == (TimerItem<T>*)NULL ) // nothing in the link list
{
tail = itemPtr;
itemPtr->next = (TimerItem<T>*) NULL;
}
else
{
itemPtr->next = head;
head->prev = itemPtr;
head == NULL here, you made it so a bit up. By the way, we use 0 and not
NULL in C++.
Not necessarily true (I still prefer to use NULL, I like the visual
reminder that I'm talking about a pointer and not an int. When 'nulptr'
becomes Standard, I'll be really happy. However, we do tend to not ever
cast NULL (or 0) to a specific pointer type. There should be no need to.