D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] STL / API ?Que? (was gcc)



On Sunday 20 January 2002 1:35 am, you wrote:
Neil Williams wrote:
So what was the point of writing it in Java??!!

Having written a non-portable Java program... Our motivation was
to allow easier portability in the future, at the time Java's
printing facilities left us cold, so we cheated in the printing
class. Fitting alternative printing solutions will be easy when
the time comes.

Not sure about Nokia's motivation.

Have you tried writing in GridLayout()? After the precise control available 
through platform dependence, the Java rendering is very ugly. It is a VERY 
high price to pay for platform independence. (Or at least was last time I 
played with it.) But that's the real point about Nokia's Java toolkit - the 
rest of the code is easily switched from C++ to Java because the syntax is 
very similar. So they did the easy bit and got 'cold feet' when the Java 
language insisted on a complete re-write of the GUI. 

I'm not saying Nokia are bad for doing that - it's a classic example of the 
failings of Java. Maybe things are better now, but forgive me if I stick to 
C/C++.

Please explain Simon - is STL akin to the API in Windoze speak?

STL is the standard template library. Templates let you apply
common algorithmns and techniques in C++.

As opposed to the API which lets you apply common functions and constructors? 
When you say STL, do you mean using TWindow() and KWindow() instead of the 
'raw' PASCAL CALLBACK functions for Windows?
e.g.
DWORD FAR PASCAL SelectProc(HWND hwnd,WORD message etc etc
or 
<windows.h>
class TWindow() {}

From the code in list.cpp, I don't think we're talking about the same 
standards. I use standard functions, standard includes and I use the class 
hierarchy of the compiler - TWindow on Borland Windows, KWindow in KDevelop. 
Then various classes to hold and pass around data between sections of the 
program and I use inheritance to add functionality. (Which is where I get 
confused with KMainWindow and QWidget - when I compile a new project in 
KDevelop - e.g. a simple MDI app - it runs OK but the windows don't display 
content. It pretends to open a text file but no text is displayed. How do I 
get the DocumentView to behave as a text editor?)

I really ought to get a Linux programming text didn't I!

Basically create a structure "node", and then create a "list"
called "top" of that structure, and then play with it a bit.

I know about structures and creating instances of the structure, it's this 
bit that confuses me:

struct node {
char c;
int i;
double d;

// here:
node () {}
node (char c, int i, double d) : c(c), i(i), d(d) {}

};

Do  node () {}  node (char c, int i, double d) : c(c), i(i), d(d) {} act as a 
constructor and destructor? Do these lines create an instance of the struct 
in the same way as 
struct node {
char c;
int i;
double d;
} top;
?

If you are using a constructor and a destructor, wouldn't it be easier to use 
a class?

class mydata {
public:
char c;int i;double d;
mydata (char Initc,int Initi,double Initd) { c=Initc;i=Initi;d=Initd;}
};

mydata sample('r',1,0.5);
sample.i=sample.i*2;
etc.

int main() {
list<node> top;
?Que?

I can't find a reference to list<> - what does this line do?

Nothing in the example requires the "list" template, and you can
probably swap 'list' for another similar template.

Hopefully you've been using them without knowing it?

I'm still confused. What are the templates similar to list? It doesn't sound 
as if I have been using such templates, I use class templates and standard 
functions but the templates just aren't making sense.

#include <list>

Where do I find the file: list?

-- 

Neil Williams
=============
http://www.codehelp.co.uk
neil@xxxxxxxxxxxxxx
linux@xxxxxxxxxxxxxx
neil@xxxxxxxxxxxx


--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly