473,624 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linked List Confusion I need some expert help Please

Y2J
I am working through this book on C++ programming, the author is
speaking of using linked lists. He gave and example which I found
confusing to say the least. So I rewrote the example in a way that I
could better understand the concept, he was trying to convey to me.

I ran my own example and it crashed and burn "what a surprise!" : (. I
ran the authors example out of the book and quess what, it crashed
also, : 0. I ran them both on my laptop that uses the blood shed C++
IDE and they both crashed, I ran them both on my desktop in MS Visual
Studio 6.0 and they both crashed.

So I kept trying to look over the code carefully and see what the hell
is going on here, but I lack the experience to understand the error
messages that are being returned to me. I need to understand this
concept as I know it is important to understand it before I can move
on.

Here is the code I re wrote:

#include <iostream>
using namespace std;

struct node
{
int data;

node *nextNode;
node *previousNode;
};

class linkedList
{
private:
node baseNode;

node *currentNode;
public:
void pushMethod(int item);

int popMethod();

};

void linkedList::pus hMethod(int item)
{
node *temporaryNodeT oBePushedOn = currentNode;

currentNode->nextNode = new node;

currentNode = currentNode->nextNode;

currentNode->previousNode = temporaryNodeTo BePushedOn;
}

int linkedList::pop Method()
{
int temporaryNodeTo BePoppedOff;

temporaryNodeTo BePoppedOff = currentNode->data;

if(currentNode->previousNode == NULL)
{
return temporaryNodeTo BePoppedOff;
}

currentNode = currentNode->previousNode ;

delete currentNode->nextNode;

return temporaryNodeTo BePoppedOff;
}

int main()
{
linkedList myLinkedList;

int data;

cout << "Enter your data, and enter -1 to exit \n";

while (data != -1)
{
cout << "Enter your next number: ";
cin >data;

myLinkedList.pu shMethod(data);
}

return 0;
} // End of double linked list example : )

*** Can anyone take the time to explain what is wrong here? ***
In the begining of the program I see this:

struct node
{
int data;

node *nextNode;
node *previousNode;
};

What doesn't make sense to me is that how can a structure be declared
with in a structure if the structure is first being declared. This
little piece of code appears as if the structure is being declared and
then two types of the same structure are being declared within it at
the same time. I thought that the structure is declared and then as a
data type and then it is used as a data type in declaring other things
such as pointers and variables. Anyways I must be retarded or
something. But the author gives like a five sentence explanation about
this then moves onto something completely different all together.

Peace, Jaret

Aug 19 '06 #1
5 3359
Y2J wrote:
I am working through this book on C++ programming, the author is
Which book, BTW?
speaking of using linked lists. He gave and example which I found
confusing to say the least. So I rewrote the example in a way that I
could better understand the concept, he was trying to convey to me.

I ran my own example and it crashed and burn "what a surprise!" : (. I
ran the authors example out of the book and quess what, it crashed
also, : 0. I ran them both on my laptop that uses the blood shed C++
IDE and they both crashed, I ran them both on my desktop in MS Visual
Studio 6.0 and they both crashed.

So I kept trying to look over the code carefully and see what the hell
is going on here, but I lack the experience to understand the error
messages that are being returned to me. I need to understand this
concept as I know it is important to understand it before I can move
on.

Here is the code I re wrote:

#include <iostream>
using namespace std;

struct node
{
int data;

node *nextNode;
node *previousNode;
};

class linkedList
{
private:
node baseNode;
What's that for? You don't seem to make any use of it.
>
node *currentNode;
public:
Your 'currentNode' is left uninitialised upon creation of
the linkedList. You probably should add a constructor here
which will initialise 'currentNode' to null.
void pushMethod(int item);

int popMethod();

};

void linkedList::pus hMethod(int item)
You don't seem to make any use of 'item'...
{
node *temporaryNodeT oBePushedOn = currentNode;

currentNode->nextNode = new node;

currentNode = currentNode->nextNode;

currentNode->previousNode = temporaryNodeTo BePushedOn;
}

int linkedList::pop Method()
{
int temporaryNodeTo BePoppedOff;

temporaryNodeTo BePoppedOff = currentNode->data;
Don't assign. Initialise. However, your 'data' member of
your 'currentNode' is never set to anything. Reading it may
be dangerous.
>
if(currentNode->previousNode == NULL)
{
return temporaryNodeTo BePoppedOff;
}

currentNode = currentNode->previousNode ;

delete currentNode->nextNode;

return temporaryNodeTo BePoppedOff;
}

int main()
{
linkedList myLinkedList;

int data;
You never initialise your 'data' object here. Your 'while' will
not reliably work. If you need to always go into the body of the
'while' below, you must initialise 'data' to something that is
not -1. 0 would do nicely.
>
cout << "Enter your data, and enter -1 to exit \n";

while (data != -1)
{
cout << "Enter your next number: ";
cin >data;

myLinkedList.pu shMethod(data);
Again, in 'pushMethod' you don't use the argument. Whatever you
enter here is not going to be used.
}

return 0;
} // End of double linked list example : )

*** Can anyone take the time to explain what is wrong here? ***
In the begining of the program I see this:

struct node
{
int data;

node *nextNode;
node *previousNode;
};

What doesn't make sense to me is that how can a structure be declared
with in a structure if the structure is first being declared.
There is no "structure with in a structure". Both 'nextNode' and
'previousNode' members are _pointers_. That's allowed. All pointers
to objects have the same size and it's independent from the contents
of the class to which they point.
This
little piece of code appears as if the structure is being declared and
then two types of the same structure are being declared within it at
the same time.
No. Look again. Do you see '*' there?
I thought that the structure is declared and then as a
data type and then it is used as a data type in declaring other things
such as pointers and variables. Anyways I must be retarded or
something. But the author gives like a five sentence explanation about
this then moves onto something completely different all together.
You need to get a better grasp at pointers to understand linked lists
and dynamic memory allocation. Please go back to the part where they
are described.

The program you posted here is riddled with logical errors, and there
is no sense in pointing them out if you don't understand such things
like pointers. Please don't take this personally. You're not as you
say, retarded. You just haven't studied enough. Perhaps a different
book is in order...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 19 '06 #2
Y2J

Victor Bazarov wrote:
Y2J wrote:
I am working through this book on C++ programming, the author is

Which book, BTW?
speaking of using linked lists. He gave and example which I found
confusing to say the least. So I rewrote the example in a way that I
could better understand the concept, he was trying to convey to me.

I ran my own example and it crashed and burn "what a surprise!" : (. I
ran the authors example out of the book and quess what, it crashed
also, : 0. I ran them both on my laptop that uses the blood shed C++
IDE and they both crashed, I ran them both on my desktop in MS Visual
Studio 6.0 and they both crashed.

So I kept trying to look over the code carefully and see what the hell
is going on here, but I lack the experience to understand the error
messages that are being returned to me. I need to understand this
concept as I know it is important to understand it before I can move
on.

Here is the code I re wrote:

#include <iostream>
using namespace std;

struct node
{
int data;

node *nextNode;
node *previousNode;
};

class linkedList
{
private:
node baseNode;

What's that for? You don't seem to make any use of it.

node *currentNode;
public:

Your 'currentNode' is left uninitialised upon creation of
the linkedList. You probably should add a constructor here
which will initialise 'currentNode' to null.
void pushMethod(int item);

int popMethod();

};

void linkedList::pus hMethod(int item)

You don't seem to make any use of 'item'...
{
node *temporaryNodeT oBePushedOn = currentNode;

currentNode->nextNode = new node;

currentNode = currentNode->nextNode;

currentNode->previousNode = temporaryNodeTo BePushedOn;
}

int linkedList::pop Method()
{
int temporaryNodeTo BePoppedOff;

temporaryNodeTo BePoppedOff = currentNode->data;

Don't assign. Initialise. However, your 'data' member of
your 'currentNode' is never set to anything. Reading it may
be dangerous.

if(currentNode->previousNode == NULL)
{
return temporaryNodeTo BePoppedOff;
}

currentNode = currentNode->previousNode ;

delete currentNode->nextNode;

return temporaryNodeTo BePoppedOff;
}

int main()
{
linkedList myLinkedList;

int data;

You never initialise your 'data' object here. Your 'while' will
not reliably work. If you need to always go into the body of the
'while' below, you must initialise 'data' to something that is
not -1. 0 would do nicely.

cout << "Enter your data, and enter -1 to exit \n";

while (data != -1)
{
cout << "Enter your next number: ";
cin >data;

myLinkedList.pu shMethod(data);

Again, in 'pushMethod' you don't use the argument. Whatever you
enter here is not going to be used.
}

return 0;
} // End of double linked list example : )

*** Can anyone take the time to explain what is wrong here? ***
In the begining of the program I see this:

struct node
{
int data;

node *nextNode;
node *previousNode;
};

What doesn't make sense to me is that how can a structure be declared
with in a structure if the structure is first being declared.

There is no "structure with in a structure". Both 'nextNode' and
'previousNode' members are _pointers_. That's allowed. All pointers
to objects have the same size and it's independent from the contents
of the class to which they point.
This
little piece of code appears as if the structure is being declared and
then two types of the same structure are being declared within it at
the same time.

No. Look again. Do you see '*' there?
I thought that the structure is declared and then as a
data type and then it is used as a data type in declaring other things
such as pointers and variables. Anyways I must be retarded or
something. But the author gives like a five sentence explanation about
this then moves onto something completely different all together.

You need to get a better grasp at pointers to understand linked lists
and dynamic memory allocation. Please go back to the part where they
are described.

The program you posted here is riddled with logical errors, and there
is no sense in pointing them out if you don't understand such things
like pointers. Please don't take this personally. You're not as you
say, retarded. You just haven't studied enough. Perhaps a different
book is in order...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
The title of the book is: C++ Programming Fundamentals by Chuck Easttom
ISBN:1584502371

I don't understant cap 'a' thing, as I have not posted many questions
here:
This is the authors code example:
//Step 1: Place the following code into your favorite text editor and
save it as linkedlist.h.
//#include "linkedlist .h"
#include <iostream>
using namespace std;
struct node
{
int data; // data can be of any type at all.
node *nextnode;
node *prevnode;
};
class linkedlist
{
private:
node base; // This is the base node
// from which other nodes will
// spring.
node *curnode;// A pointer to the current node.
public:
void push(int item);
int pop();
};
void linkedlist::pus h(int item)
{
// This function basically creates a new node and
// places it at the top of the linked list. The node
// currently at the top is moved down.
node *temp=curnode; // Temporary node
curnode->nextnode=new node;// Create new node
curnode=curnode->nextnode; // Assign current to
// new top node
curnode->data=item; // Assign the data
curnode->prevnode=tem p;// Set previous
// pointer
}
int linkedlist::pop ()
{
// This function pulls the data off the current
// node,then
// moves the node preceding the current node into the
// front
// of the linked list.
int temp;
temp=curnode->data;
// if the previous node is somehow already gone, then
// skip
// the rest.
if (curnode->prevnode == NULL)
return temp;
curnode=curnode->prevnode;
// delete the node we just popped off
delete curnode->nextnode;
return temp;
}

//Step 2: Write the following code into your favorite text editor and
save it as 13_02.cpp.
int main()
{
linkedlist mylist;
int data;
cout << "Enter your data, and enter -1 to exit \n";
while(data != -1)
{
cout << "Enter your next number \n";
cin>data;
mylist.push(dat a);
}
return 0;
}// end main

I included the header file into my main source file so I could better
follow what was going on. Thanks for your reply
Peace, Jaret

Aug 19 '06 #3
Y2J wrote:
Victor Bazarov wrote:
>Y2J wrote:
>>I am working through this book on C++ programming, the author is

Which book, BTW?
[..previous analysis of the program snipped..]

The title of the book is: C++ Programming Fundamentals by Chuck
Easttom ISBN:1584502371

I don't understant cap 'a' thing, as I have not posted many questions
here:
The capital A thing is for you if you want to contact me by e-mail,
my return address is mangled.
This is the authors code example:
OK, let's take a look...
//Step 1: Place the following code into your favorite text editor and
save it as linkedlist.h.
//#include "linkedlist .h"
#include <iostream>
using namespace std;
struct node
{
int data; // data can be of any type at all.
node *nextnode;
node *prevnode;
};
class linkedlist
{
private:
node base; // This is the base node
// from which other nodes will
// spring.
node *curnode;// A pointer to the current node.
public:
Again, this class does not initialise 'curnode' upon its construction.
That's what causes the crash. It should probably do

linkedlist() : curnode(&base) {}

As soon as you add this, the program does not crash any more. Try it.
void push(int item);
int pop();
};
void linkedlist::pus h(int item)
{
// This function basically creates a new node and
// places it at the top of the linked list. The node
// currently at the top is moved down.
node *temp=curnode; // Temporary node
curnode->nextnode=new node;// Create new node
curnode=curnode->nextnode; // Assign current to
// new top node
curnode->data=item; // Assign the data
curnode->prevnode=tem p;// Set previous
// pointer
}
int linkedlist::pop ()
{
// This function pulls the data off the current
// node,then
// moves the node preceding the current node into the
// front
// of the linked list.
int temp;
temp=curnode->data;
// if the previous node is somehow already gone, then
// skip
// the rest.
if (curnode->prevnode == NULL)
return temp;
curnode=curnode->prevnode;
// delete the node we just popped off
delete curnode->nextnode;
return temp;
}

//Step 2: Write the following code into your favorite text editor and
save it as 13_02.cpp.
int main()
{
linkedlist mylist;
int data;
^^^^^^^^^^^^
Again, this is uninitialised object. You need to replace it with

int data = 0;
cout << "Enter your data, and enter -1 to exit \n";
while(data != -1)
{
cout << "Enter your next number \n";
cin>data;
mylist.push(dat a);
}
return 0;
}// end main

I included the header file into my main source file so I could better
follow what was going on. Thanks for your reply
You're welcome. I still think you should chuck this book and get
yourself a copy of "Accelerate d C++", for example, or any other
beginner's book on C++ that has decent reviews on www.accu.org.
There is "Thinking in C++" by Bruce Eckel (IIRC), freely available
on the 'Net.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 19 '06 #4
Y2J

Victor Bazarov wrote:
Y2J wrote:
Victor Bazarov wrote:
Y2J wrote:
I am working through this book on C++ programming, the author is

Which book, BTW?
[..previous analysis of the program snipped..]
The title of the book is: C++ Programming Fundamentals by Chuck
Easttom ISBN:1584502371

I don't understant cap 'a' thing, as I have not posted many questions
here:

The capital A thing is for you if you want to contact me by e-mail,
my return address is mangled.
This is the authors code example:

OK, let's take a look...
//Step 1: Place the following code into your favorite text editor and
save it as linkedlist.h.
//#include "linkedlist .h"
#include <iostream>
using namespace std;
struct node
{
int data; // data can be of any type at all.
node *nextnode;
node *prevnode;
};
class linkedlist
{
private:
node base; // This is the base node
// from which other nodes will
// spring.
node *curnode;// A pointer to the current node.
public:

Again, this class does not initialise 'curnode' upon its construction.
That's what causes the crash. It should probably do

linkedlist() : curnode(&base) {}

As soon as you add this, the program does not crash any more. Try it.
void push(int item);
int pop();
};
void linkedlist::pus h(int item)
{
// This function basically creates a new node and
// places it at the top of the linked list. The node
// currently at the top is moved down.
node *temp=curnode; // Temporary node
curnode->nextnode=new node;// Create new node
curnode=curnode->nextnode; // Assign current to
// new top node
curnode->data=item; // Assign the data
curnode->prevnode=tem p;// Set previous
// pointer
}
int linkedlist::pop ()
{
// This function pulls the data off the current
// node,then
// moves the node preceding the current node into the
// front
// of the linked list.
int temp;
temp=curnode->data;
// if the previous node is somehow already gone, then
// skip
// the rest.
if (curnode->prevnode == NULL)
return temp;
curnode=curnode->prevnode;
// delete the node we just popped off
delete curnode->nextnode;
return temp;
}

//Step 2: Write the following code into your favorite text editor and
save it as 13_02.cpp.
int main()
{
linkedlist mylist;
int data;
^^^^^^^^^^^^
Again, this is uninitialised object. You need to replace it with

int data = 0;
cout << "Enter your data, and enter -1 to exit \n";
while(data != -1)
{
cout << "Enter your next number \n";
cin>data;
mylist.push(dat a);
}
return 0;
}// end main

I included the header file into my main source file so I could better
follow what was going on. Thanks for your reply

You're welcome. I still think you should chuck this book and get
yourself a copy of "Accelerate d C++", for example, or any other
beginner's book on C++ that has decent reviews on www.accu.org.
There is "Thinking in C++" by Bruce Eckel (IIRC), freely available
on the 'Net.
Thanks it worked just like you said t would: is this the book you where
talking about?
Accelerated C++
Practical Programming by Example
by Andrew Koenig and Barbara E. Moo
Addison-Wesley, 2000
ISBN 0-201-70353-X
Pages 336
Second Printing

Because I actually have that book, and was considering reading it next.
I just wanted to finish the book I was on in order to disipline myself
to finish what I started. I only got halfway through the Dietel book on
C++ and was really disappointed with it. There allot of books out there
and they all claim to be able to teach you how to program C++, and
maybe that is true; but they don't all claim to teach you how to
understand C++ which I have found in most csases is disappointing.

I thought I did understand pointers to some degree, but the author just
took off from something simple to understand and got into something I
just could'nt seem to grasp.
When you "pointed" out that the pointer was not initialized I
remembered the author in the book saying always to point the pointer to
something or else you could crash your system and not to point it
beyond the counds of an array or esle you would get yourself in
trouble.

What books have you read that you found helpfull in learning C++? Yeah
I guess I still suck at understanding the concept of pointers,
especially if I can't even notice that they are not initilized in the
code properly. Thank you for your swift response and input.

Peace, Jaret

Aug 19 '06 #5
Y2J wrote:
>[..]
Thanks it worked just like you said t would: is this the book you
where talking about?
Accelerated C++
Practical Programming by Example
by Andrew Koenig and Barbara E. Moo
Addison-Wesley, 2000
ISBN 0-201-70353-X
Pages 336
Second Printing
Yes. And also do visit www.accu.org, book review section. Time well
spent, if you ask me.
Because I actually have that book, and was considering reading it
next. I just wanted to finish the book I was on in order to disipline
myself to finish what I started. I only got halfway through the
Dietel book on C++ and was really disappointed with it. There allot
of books out there and they all claim to be able to teach you how to
program C++, and maybe that is true; but they don't all claim to
teach you how to understand C++ which I have found in most csases is
disappointing.
I don't know how good the Deitel book is (and not sure which one you
refer to, I think there are several), but look at www.accu.org, and
you will probably find it reviewed.
I thought I did understand pointers to some degree, but the author
just took off from something simple to understand and got into
something I just could'nt seem to grasp.
Pointers can be intimidating, no doubt. Often it's better to put them
aside for a while. Linked lists and other data structures are not
trivial either, and of course they make use of pointers all over, and
you gotta understand pointers relatively well to grasp data structures
better. One will help the other. Maybe a decent book (like Robert
Sedgewick's "Algorithms in C++") could help...
When you "pointed" out that the pointer was not initialized I
remembered the author in the book saying always to point the pointer
to something or else you could crash your system and not to point it
beyond the counds of an array or esle you would get yourself in
trouble.
I remember from my early days on Usenet I've debated the rule for
beginners to initialise everything; and while I don't remember the
exact argument or what we ended up with, if you ask me now, I would
probably recommend it. IOW, whatever it is, a pointer, an int,
a double, a class object, a reference, a pointer to function, don't
let it go uninitialised. Ever.
What books have you read that you found helpfull in learning C++?
I started with Stroustrup, 1st edition, translated into Russian (very
likely pirated), but it was a long time ago, and it was essentially
the only book available. I then moved onto "The Annotated Reference
Manual" by Ellis and Stroustrup, which I don't recommend as a learning
material. Next was "Advanced C++" by James Coplien. All those books
are now rather old, except "The C++ Programming Language" by Bjarne
Stroustrup because it's undergone several editions, and many more
printings. I have the Special Edition, and only recommend it to those
who are serious about C++.

Nowadays there are many [relatively] new books, and "Acc'ted C++" by
Koenig and Moo is one of the best, or so I hear. I don't own a copy
myself, probably don't have a need for it at this point. I heard
good things about "Thinking in C++" as well. Just look in the archives
of this newsgroup (http://groups.google.com/group/comp.lang.c++) for
any book recommendations .

Some find Stroustrup's "The C++ Programming Language" a bit dry or
possibly difficult to study the language by, but it's mostly because
it's so jam-packed with information.
Yeah I guess I still suck at understanding the concept of pointers,
[..]
Nah, you just need a bit more time with it. Eventually it becomes
your "second nature", don't worry about it. The more you apply them
the simpler they appear. What sometimes helps is to understand how
they are represented in memory, what they mean, how the hardware
works. It's not necessary, but it's useful if you want to be any
good at programming. Check out "Inside the C++ Object Model" by
Lippman.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 19 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7946
by: Jeffrey Silverman | last post by:
Hi, all. I have a linked list. I need an algorithm to create a tree structure from that list. Basically, I want to turn this: $list = array( array( 'id' => 'A', 'parent_id' => null, 'value' => 'aaa') , array( 'id' => 'B', 'parent_id' => 'A', 'value' => 'bbb') , array( 'id' => 'C', 'parent_id' => 'B', 'value' => 'ccc') , array( 'id' => 'D', 'parent_id' => 'A', 'value' => 'ddd')
7
4817
by: Chris Ritchey | last post by:
Hmmm I might scare people away from this one just by the title, or draw people in with a chalange :) I'm writting this program in c++, however I'm using char* instead of the string class, I am ordered by my instructor and she does have her reasons so I have to use char*. So there is alot of c in the code as well Anyways, I have a linked list of linked lists of a class we defined, I need to make all this into a char*, I know that I...
11
6353
by: fighterman19 | last post by:
because in linked list each node contains only one digit like curr->nodevalue_1= 0 curr->nodevalue_2=1 sum->nodevalue = curr->nodevalue_1 + curr->nodevalue_2 so when the number go up to >10 or >100 and the linked list need another node (I can add the node to the front ) but how can do the sum ? ex: 89+144 = 233
6
4833
by: newtothis | last post by:
Being new to the use of C++ I have written a linked list program. It seems to crash after I delete from the list and then add a new node. Also this is not college homework, I have also looked at various postings here on the topic. They do not seem to help.
1
2037
by: Tim | last post by:
I can't seem to figure out why this very simple linked list wont build.. I mean, there is no intelligence, just add to end. Anyway, please let me know if something i can do will make head (the root pointer) not be null. /* LINKED LIST DEFINITIONS */ typedef struct a_fnode {
51
8615
by: Joerg Schoen | last post by:
Hi folks! Everyone knows how to sort arrays (e. g. quicksort, heapsort etc.) For linked lists, mergesort is the typical choice. While I was looking for a optimized implementation of mergesort for linked lists, I couldn't find one. I read something about Mcilroy's "Optimistic Merge Sort" and studied some implementation, but they were for arrays. Does anybody know if Mcilroys optimization is applicable to truly linked lists at all?
10
10495
by: Aditya | last post by:
Hi All, I would like to know how it is possible to insert a node in a linked list without using a temp_pointer. If the element is the first element then there is no problem but if it is in between then what is the best solution.
12
4027
by: kalyan | last post by:
Hi, I am using Linux + SysV Shared memory (sorry, but my question is all about offset + pointers and not about linux/IPC) and hence use offset's instead on pointers to store the linked list in the shared memory. I run fedora 9 and gcc 4.2. I am able to insert values in to the list, remove values from the list, but the problem is in traversing the list. Atlease one or 2 list nodes disappear when traversing from the base of the list or...
7
5761
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it compiled no problem. But I can't find the what the problem is with templates? Please help. The main is in test-linked-list.cpp. There are two template classes. One is List1, the other one is ListNode. The codes are below: // test-linked-list.cpp :...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8625
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.