1. for/while Warnings

I found a data structures tutorial online that I followed through a little bit, and I wrote my own version of the linked list class it talks about. It works fine, but every time I compile it gives me a warning for each for/while loop I have: "Functions containing while are not expanded inline." It doesn't affect how the program actually works, but I'm just wondering what these warnings are about.

Here's my linked list class along with a basic main function to test it, just in case it might help.

Code:
```#include <iostream>

using namespace std;

private:
// A node structure; each data value is a node
struct node {
int data;
} *p;

public:
// Constructor
p = NULL; // Primary node
}
// Desctructor
// Destroy the list
node *q;
while (p != NULL) {
q = p;
delete q;
}
}
// Append a new data value
// @param val the data value to append
void append (int val) {
// If the list is empty
if (p == NULL) {
p = new node;
p->data = val;
}
// If the list is not empty
else {
node *q, *t;
q = p;
t = new node;
t->data = val;
}
}
// Adds an item to the front of the list
// @param val the item to add
// @return true if it was added successfully
node *q;
q = new node;
q->data = val;
p = q;
return true;
}
// Adds an item after a certain position
// @param j the position to add
// @param val the item to add
// @return true if it was added successfully
bool add_after (int j, int val) {
node *q, *t;
q = p;
for (int i = 0; i<j; i++) {
if (q == NULL)
return false;
}
t = new node;
t->data = val;
return true;
}
// Deletes the first instance of val
// @param val the value to find and delete
// @return true if the value was found and deleted
bool del (int val) {
// t is the node pior, q is the current node
node *q, *t;
q = p;
t = NULL;
while (q->data != val) {
return false;
t = q;
}
// If the data was p, the first value in the list
if (t == NULL) {
delete q;
}
// If the data found was not the first in the list
else {
node *r;
delete q;
}
return true;
}
// Display the list
void display () {
node *q;
cout << "[";
q = p;
cout << q->data << ", ";
}
cout << q->data;
cout << "]" << endl;
}
// Get the size of the list
// @return the number of nodes in the list
int size () {
int c = 0;
node *q;
for (q = p; q != NULL; q = q->link)
c++;
return c;
}
};

int main () {
list.append(1);
list.append(3);
list.append(4);
list.display();
cout << "Size: " << list.size() << endl;
return 0;
}```

2. You should declare and define your methods which contain more than one line of code at different places, which should solve the compiler warning.

meaning:

Code:
```class MyClass
{
private:
...
public:
void MyMethod():
};

void MyClass::MyMethod()
{
...   // Definition
}```

3. All functions actually defined in the class are presumed to have "inline" in front of them. The compiler is telling you that, even though you want these functions to be inline, they won't be.

4. I knew you could define those functions outside of the class definition, I just didn't realize that that was the problem.

Thanks.