Are C++ templates a precompiler thing?

J

JohnQ

Ian Collins said:
Could you do us all a favor and change or fix your newsreader to quote
properly. Don't go blaming James's character set, no one else here is
troubled by it.

All I know that it happens whenever someone has NON-ENGLISH characters in
their post. Why should I make concessions to posts that have elements that
are in a foreign language? Maybe I feel like making a little stand that
English newsgroups should be 7-bit ASCII. (Though the problem has not yet
been identified).

John
 
I

Ian Collins

JohnQ said:
All I know that it happens whenever someone has NON-ENGLISH characters in
their post. Why should I make concessions to posts that have elements that
are in a foreign language? Maybe I feel like making a little stand that
English newsgroups should be 7-bit ASCII. (Though the problem has not yet
been identified).
It's not for your benefit, your replies are bloody hard for everyone
else to read.
 
J

JohnQ

Ian Collins said:
Could you do us all a favor and change or fix your newsreader to quote
properly. Don't go blaming James's character set, no one else here is
troubled by it.

I think I've tried everything I can on this end to no avail. I know that
when there are no extended characters in the signature of the post,
everything works fine, since JK sent one post without those characters and
it worked.

John
 
I

Ian Collins

JohnQ said:
I think I've tried everything I can on this end to no avail. I know that
when there are no extended characters in the signature of the post,
everything works fine, since JK sent one post without those characters
and it worked.
Even something a crappy as outlook can quote messages with non-ascii
characters. There are plenty of other users who don't have this
problem. I think you just enjoy being a pain in the arse.
 
J

JohnQ

Ian Collins said:
Even something a crappy as outlook can quote messages with non-ascii
characters.

If I reply in HTML, it works. In plain text, it doesn't. I wonder if the
fact that the 8-bit characters are in the signature has anything to do with
it. I'd be interested in seeing if the 8-bit chars in ONLY a message body
would cause the problem.
There are plenty of other users who don't have this problem.

So I would assume also. I tried it on another account on my computer and got
the same result. I'll go try it from another computer here... Same result
(and it's a virtually clean install of WinXP).
I think you just enjoy being a pain in the arse.

LOL, not. Tell me how to fix it and I will. (No, I'm not switching
newsreaders).

John
 
J

James Kanze

All I know that it happens whenever someone has NON-ENGLISH characters in
their post. Why should I make concessions to posts that have elements that
are in a foreign language?

In other words, I don't have a right to post because of my
address, and others don't have that right because of their name.
Maybe I feel like making a little stand that
English newsgroups should be 7-bit ASCII. (Though the problem has not yet
been identified).

You can't write correct English in just 7-bit ASCII. Words like
"naïve" still cause problems.

And the actual problem is independant of the characters used; it
still appeared when I removed the accented characters from my
posting. The actual problem is that somewhere, a system is
converting my postings to quoted-ascii, and your newsreader
doesn't seem to be able to handle that. (In short, the problem
is that you are receiving pure, 7-bit ASCII.)
 
J

James Kanze

I think I've tried everything I can on this end to no avail. I know that
when there are no extended characters in the signature of the post,
everything works fine, since JK sent one post without those characters and
it worked.

No it didn't. The posts which work are those from my home site,
where the headers don't include a "Content-Transfer-Encodeing:
quoted-printable" line. I don't know where this line is
inserted; it may be that some site between me and Google is
using it to work-around a site that doesn't support 8-bit codes.
But it's a fully legitimate line, even if I didn't intend it.

There are any number of free newsreaders which actually work.
There's really no excuse for not using them. And quoting by
hand isn't that difficult either, at least not with a good
editor. I've done it in the past when I didn't have direct
access. (In the editor I use: ":%s:^.:> &:". Which I can bind
to a function key if I want.) I can understand such problems in
a non-technical group, but surely anyone posting here knows how
to use such tools.
 
J

JohnQ

I think I've tried everything I can on this end to no avail. I know that
when there are no extended characters in the signature of the post,
everything works fine, since JK sent one post without those characters and
it worked.

"No it didn't. The posts which work are those from my home site,
where the headers don't include a "Content-Transfer-Encodeing:
quoted-printable" line."

Well it's also devoid of any encoded characters also. So that post went
through something that stripped them out and replaced them with the
best-match English character?

"I don't know where this line is
inserted; it may be that some site between me and Google is
using it to work-around a site that doesn't support 8-bit codes.
But it's a fully legitimate line, even if I didn't intend it."

"There are any number of free newsreaders which actually work.
There's really no excuse for not using them."

Sure there is: installing and maintaining an addtional program.

"And quoting by
hand isn't that difficult either, at least not with a good
editor. I've done it in the past when I didn't have direct
access. (In the editor I use: ":%s:^.:> &:". Which I can bind
to a function key if I want.) I can understand such problems in
a non-technical group, but surely anyone posting here knows how
to use such tools."

And the excuse for posting partially in French is...?

John
 
J

JohnQ

All I know that it happens whenever someone has NON-ENGLISH characters in
their post. Why should I make concessions to posts that have elements that
are in a foreign language?

"In other words, I don't have a right to post because of my
address, and others don't have that right because of their name."

It would be nice if y'all posted in English instead of just partially so.
It's the same response that one gets when they post HTML or post binaries: i
put all of those things in the same category.
Maybe I feel like making a little stand that
English newsgroups should be 7-bit ASCII. (Though the problem has not yet
been identified).

"You can't write correct English in just 7-bit ASCII. Words like
"naove" still cause problems."

Did you mean 'naive'? Are you suggesting that an English word has an umlaut?

"And the actual problem is independant of the characters used; it
still appeared when I removed the accented characters from my
posting."

This post of yours works:


It is devoid of encoded characters in it (with '=xx' where the 8-bit chars
were).

"The actual problem is that somewhere, a system is
converting my postings to quoted-ascii, and your newsreader
doesn't seem to be able to handle that."

And OE allows me to SEND with quoted-printable as a UTF encoding. Bizarre
that it would choke, then, on incoming messages.

" (In short, the problem is that you are receiving pure, 7-bit ASCII.)"

The combination of the "quoted-printable" header and the encoded characters.
(Or so we think). I'll post something in an MS support group tomorrow and
ask them what's up with OE in this scenario. And if no one else is
experiencing the same thing with OE, then I begin to wonder what global
system setting could possibly cause such bizarro behavior. I've tried it on
2 machines here and the same thing happens.

John
 
J

JohnQ

Thomas J. Gritzan said:
Then do it with files:

#define LIST_TYPE int
#define LIST_NAME int_list
#include <johnq/list.h>

#define LIST_TYPE double
#define LIST_NAME double_list
#include <johnq/list.h>

No need for backslashes in the file. No need for a class generating
#define
also.

Neat trick (does it work? I wouldn't expect it to and haven't tried it yet).
Can it
be depended on across implementations? Because it doesn't seem like it's
expanding anything at the #include place like a macro would. Where is the
typed list class definition expanded at? I have a hard time believing that
the
compiler would make multiple copies of the header file somewhere and that
those would end up in the compiled code.

If it works, you can put a concatenator (#define slist(T) concat2(slist_,T))
in the "template file". Then you can eliminate the LIST_NAME define above. I
think you'll need an "#undef LIST_TYPE" after the #include line though in
any case.
Maybe your debugger is happier with it, too, so it can step through your
functions (didn't try).


comp.compilers - for compiler hacking
comp.lang.misc - for discussions about languages

I added them now that I'm investigating this stuff.

John
 
T

Thomas J. Gritzan

JohnQ said:
Thomas J. Gritzan said:
Then do it with files:

#define LIST_TYPE int
#define LIST_NAME int_list
#include <johnq/list.h>
[...]

Neat trick (does it work? I wouldn't expect it to and haven't tried it
yet). Can it
be depended on across implementations? Because it doesn't seem like it's
expanding anything at the #include place like a macro would.

Its just text. An #include directive just places the contents of the file
where the #include directive is. It's a stupid preprocessor after all.
That's why you need include guards: To avoid double declaration/definition.

With your DefineSListOfType() macro you maybe will have this double
definition problem some times, too.
If it works, you can put a concatenator (#define slist(T)
concat2(slist_,T))
in the "template file". Then you can eliminate the LIST_NAME define
above. I
think you'll need an "#undef LIST_TYPE" after the #include line though in
any case.

The #undef can be in the include file for ease of use.
There also should be:
#ifndef LIST_TYPE
#error LIST_TYPE must be defined...
#endif

To catch errors early.

Well I just can't understand what should be easier with such macro tricks
when you can use templates instead.
 
T

Thomas J. Gritzan

JohnQ said:
"There are any number of free newsreaders which actually work.
There's really no excuse for not using them."

Sure there is: installing and maintaining an addtional program.

Says somebody who talks about hacking a preprocessor just to do something
that the compiler already can to with templates?

Just try Mozilla Thunderbird. It's close to OE in usage but without the bugs.
"And quoting by
hand isn't that difficult either, at least not with a good
editor. [...]"

And the excuse for posting partially in French is...?

Being french.
 
B

BobR

Thomas J. Gritzan wrote in message...
JohnQ said:
Then do it with files:

#define LIST_TYPE int
#define LIST_NAME int_list
#include <johnq/list.h>
[...]

Neat trick (does it work? I wouldn't expect it to and haven't tried it
yet). Can it
be depended on across implementations? Because it doesn't seem like it's
expanding anything at the #include place like a macro would.

Its just text. An #include directive just places the contents of the file
where the #include directive is.

Example (JohnQ try this):

// --- Guts.h ---
cout<<"Hello World, from Guts.h"<<std::endl;
#define BLAHBLAH cout<<"Hello World2, from Guts.h"<<std::endl;
// --- Guts.h --- END

// --- main.cpp ---
#include <iostream>
int main(){ using std::cout;
#include "Guts.h"
BLAHBLAH
// note no semicolon at end of that line
return 0;
}
// --- main.cpp --- END
 
O

Owen Jacobson

Neat trick (does it work? I wouldn't expect it to and haven't tried it yet).

Yes. The preprocessor works by token manipulation only, and #include
instructs it to replace the #include directives with an implementation-
defined set of tokens (by convention, the contents of the named file),
then continue preprocessing.
Can it be depended on across implementations? Because it doesn't seem like it's
expanding anything at the #include place like a macro would. Where is the
typed list class definition expanded at? I have a hard time believing that
the
compiler would make multiple copies of the header file somewhere and that
those would end up in the compiled code.

If your compiler supports it, put together a small sample and run it
through the preprocessor phase only (gcc -E, for instance) and examine
the output. The contents of johnq/list.h will appear twice, with
LIST_TYPE and LIST_NAME replaced appropriately.
That's why I'm investigating hacking a preprocessor to do a templates
implementation.

You have asked: "Are C++ templates a precompiler thing?" The answer
is no.

You meant to ask: "Can a template mechanism be implemented using the C+
+ preprocessor?" The answer is yes, you can do that if you think it's
better.

You may also have meant to ask: "Can a template mechanism be
implemented by textual manipulation alone?" The answer is yes, you
can do that if you think it's better; languages which do so are
(mostly) not C++ and are off-topic here.

Why is this thread still going, again?
 
J

JohnQ

"James Kanze" <[email protected]> wrote in message

"And the problem doesn't seem to be the characters themselves,
because I modified my .sig in one posting, to remove them. The
problem is, I think, one of the headers, probably inserted by
Google."

From Wikipedia:

"Quoted-printable, or QP Encoding, is an encoding using printable characters
(i.e. alphanumeric and the equals sign "=") to transmit 8-bit data over a
7-bit data path. It is defined as a MIME content transfer encoding for use
in Internet e-mail."

"Lines of quoted-printable encoded data must not be longer than 76
characters. To satisfy this requirement without altering the encoded text,
soft line breaks may be added as desired. A soft line break consists of an
"=" at the end of an encoded line, and does not cause a line break in the
decoded text."

So that probably means that if there are 8-bit characters in the message
being encoded, the line breaks are probably being converted also and being
moved forward like that. So, the 8-bit characters are messing up the concept
of "lines ending in CR/LF" that newsreaders are expecting.

Should OE be able to handle quoted-printable? Maybe, but as far as I can
tell, news articles should only contain characters 1-127 of the ASCII
character set (RFC 822). So, if something is encoding your articles into
quoted-printable based upon the extended (illegal) characters (the same
thing happens with other peoples' articles that have extended characters in
them, I have noticed), well.. "if it hurts when you do that, don't do
that!".

It appears to me that my newsreader should never see anything but
CR/LF-terminated text lines, but perhaps NNTP has been updated to say that
newsreaders should be able to handle encoded articles and specific
encodings? If no update to NNTP exists that deals with different line
encodings, then whoever/whatever is pushing the non-CR/LF articles around
(or putting 8-bit characters in messages) deserves the flak. By putting
8-bit characters in what was designed for 7-bit ASCII, you're probably
asking NNTP to do something it was not intended for.

What the current state of all this is officially, I dunno. If
quoted-printable is expected to be handled by newsreaders (specified in
NNTP), then MS should fix OE. If encodings aren't addressed by the RFCs,
then people shouldn't expect them to be supported everywhere or anywhere
(are binaries in newsgroups an ad hoc hack?). Obviously, just turning
something into ASCII as an encoded article is not adequate because it relies
on proper decoding at the endpoint, which may not be present and probably
won't be if it is ad hoc usage other than designed for.

Personally, I like English and 7-bit ASCII because it makes stuff a lot
simpler.

John
 
J

James Kanze

"James Kanze" <[email protected]> wrote in message

[...]
"In other words, I don't have a right to post because of my
address, and others don't have that right because of their name."
It would be nice if y'all posted in English instead of just partially so.

I am posting in English. My address doesn't change just because
I'm speaking English. Neither does Erik Wikström's name.
It's the same response that one gets when they post HTML or
post binaries: i put all of those things in the same category.

If I were posting in French or German, you'd have a point. But
I'm not.
"You can't write correct English in just 7-bit ASCII. Words like
"naove" still cause problems."
Did you mean 'naive'? Are you suggesting that an English word
has an umlaut?

The correct spelling in English uses a diaeresis over the i, at
least according to my dictionaries. In North American English,
it's optional; in British English, it's required.

Like most languages, correctly typeset English requires more
characters than are available on a standard typewriter keyboard
(or in US ASCII), and so adopts compromizes when the characters
aren't possible. In the 1970's, we accepted such compromizes in
computer text. Today, much less so.
"And the actual problem is independant of the characters used; it
still appeared when I removed the accented characters from my
posting."
This post of yours works:

It is devoid of encoded characters in it (with '=xx' where the 8-bit chars
were).
"The actual problem is that somewhere, a system is
converting my postings to quoted-ascii, and your newsreader
doesn't seem to be able to handle that."
And OE allows me to SEND with quoted-printable as a UTF encoding. Bizarre
that it would choke, then, on incoming messages.
" (In short, the problem is that you are receiving pure, 7-bit ASCII.)"
The combination of the "quoted-printable" header and the encoded characters.
(Or so we think).

Or something. I agree that we aren't quite sure where the
problem lies. From what I've seen, a compliant newsreader
should be able to handle what I've posted, but it isn't what I
want to post, either. Somethings not behaving the way it should
be, even before the message gets to you.

One further update, however: the problem doesn't affect just
your answers to me---other people using OE have the same
problem. And as we've seen, I'm not the only person causing
this problem either. Also, and in my mind, this is very
significant, the problem is new. People have been posting
answers to my postings for a very long time, and I'm sure many
were using OE. Something has changed in the last week or two.
I don't know what, but that sort of makes me suspect Google.
Their software seems particularly unstable and changing.
I'll post something in an MS support group tomorrow and
ask them what's up with OE in this scenario. And if no one else is
experiencing the same thing with OE, then I begin to wonder what global
system setting could possibly cause such bizarro behavior. I've tried it on
2 machines here and the same thing happens.

One poster in fr.comp.lang.c++ said he had the same problem with
my posts. He blamed it on OE not handling quoted-ascii
correctly.
 
D

Duane Hebert

I'm going to try to find out where it is inserted in my case,
and get rid of it if I can. But you really should get your
newsreader fixed. As far as I can tell, you're the only one who
has this problem.

I'm using OE and don't seem to have any problem with
the characters themselves. In replying though, I had
to add the ">" in the above as OE stopped paying attention
to comments at that point. Not sure if the two are
related though.
 
J

JohnQ

"James Kanze" <[email protected]> wrote in message

[...]
"In other words, I don't have a right to post because of my
address, and others don't have that right because of their name."
It would be nice if y'all posted in English instead of just partially so.

"I am posting in English. My address doesn't change just because
I'm speaking English. Neither does Erik Wikström's name."

But the words or his name are not in English if they have non-English
characters in them.
It's the same response that one gets when they post HTML or
post binaries: i put all of those things in the same category.

"If I were posting in French or German, you'd have a point. But
I'm not."

Untranslated foreign language words are not English words.
"You can't write correct English in just 7-bit ASCII. Words like
"naove" still cause problems."
Did you mean 'naive'? Are you suggesting that an English word
has an umlaut?

"The correct spelling in English uses a diaeresis over the i, at
least according to my dictionaries. In North American English,
it's optional; in British English, it's required."

"Like most languages, correctly typeset English requires more
characters than are available on a standard typewriter keyboard
(or in US ASCII), and so adopts compromizes when the characters
aren't possible. In the 1970's, we accepted such compromizes in
computer text. Today, much less so."

Well that's the first time that I've heard that the English alphabet has
more than 26 characters. Someone better contact all the grade schools across
the USA and clue them in.

"And the actual problem is independant of the characters used; it
still appeared when I removed the accented characters from my
posting."
This post of yours works:

It is devoid of encoded characters in it (with '=xx' where the 8-bit chars
were).
"The actual problem is that somewhere, a system is
converting my postings to quoted-ascii, and your newsreader
doesn't seem to be able to handle that."
And OE allows me to SEND with quoted-printable as a UTF encoding. Bizarre
that it would choke, then, on incoming messages.
" (In short, the problem is that you are receiving pure, 7-bit ASCII.)"
The combination of the "quoted-printable" header and the encoded
characters.
(Or so we think).

Or something. I agree that we aren't quite sure where the
problem lies.

I think I have it figured out (see my post I posted in this thread earlier
today or last night).

"From what I've seen, a compliant newsreader
should be able to handle what I've posted,"

The question is "compliant to what?". Can you reference the source to comply
to? My cursory research indicates that putting 8-bit characters in news
articles is a no-no.

"but it isn't what I want to post, either. Somethings not behaving the way
it should
be, even before the message gets to you."

Either Erik Wikström is using the same newsreader as you are or there's some
kind of commonality in handling the 8-bit character-laden articles (encoding
the article) by servers or certain servers. It will be interesting to see if
this post of mine, with the 8-bit characters, results in the same problem.

"One further update, however: the problem doesn't affect just
your answers to me---other people using OE have the same
problem."

Oh, well that is "good" to hear.

" And as we've seen, I'm not the only person causing
this problem either. Also, and in my mind, this is very
significant, the problem is new. People have been posting
answers to my postings for a very long time, and I'm sure many
were using OE. Something has changed in the last week or two."

I do believe that is true because certainly I've responded to your posts in
the past and haven't always had to deal with the lack of proper quoting.

"I don't know what, but that sort of makes me suspect Google.
Their software seems particularly unstable and changing."

MS concedes it's a problem with OE and they hope to have it fixed in the
next release of OE (whether that means the next patch or on Vista, I don't
know). Whether allowing the encodings or 8-bit character handling in NNTP is
specified or not, I would like to know.
I'll post something in an MS support group tomorrow and
ask them what's up with OE in this scenario. And if no one else is
experiencing the same thing with OE, then I begin to wonder what global
system setting could possibly cause such bizarro behavior. I've tried it
on
2 machines here and the same thing happens.

"One poster in fr.comp.lang.c++ said he had the same problem with
my posts. He blamed it on OE not handling quoted-ascii
correctly."

That's what MS conceded. Though I'd prefer 7-bit clean newsgroups when they
are English groups.

John
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

"And the problem doesn't seem to be the characters themselves,
because I modified my .sig in one posting, to remove them. The
problem is, I think, one of the headers, probably inserted by
Google."

From Wikipedia:

"Quoted-printable, or QP Encoding, is an encoding using printable characters
(i.e. alphanumeric and the equals sign "=") to transmit 8-bit data over a
7-bit data path. It is defined as a MIME content transfer encoding for use
in Internet e-mail."

"Lines of quoted-printable encoded data must not be longer than 76
characters. To satisfy this requirement without altering the encoded text,
soft line breaks may be added as desired. A soft line break consists of an
"=" at the end of an encoded line, and does not cause a line break in the
decoded text."

So that probably means that if there are 8-bit characters in the message
being encoded, the line breaks are probably being converted also and being
moved forward like that. So, the 8-bit characters are messing up the concept
of "lines ending in CR/LF" that newsreaders are expecting.

Should OE be able to handle quoted-printable? Maybe, but as far as I can
tell, news articles should only contain characters 1-127 of the ASCII
character set (RFC 822). So, if something is encoding your articles into
quoted-printable based upon the extended (illegal) characters (the same
thing happens with other peoples' articles that have extended characters in
them, I have noticed), well.. "if it hurts when you do that, don't do
that!".

Actually the bodies of the message shall be UTF-8:

This specification extends NNTP from US-ASCII [ANSI1986] to UTF-8
[RFC3629]. Except in the two areas discussed below, UTF-8 (which is
a superset of US-ASCII) is mandatory, and implementations MUST NOT
use any other encoding.

Headers though should be in US-ASCII and the char-set of the message
shall be indicated in the headers using MIME.

I have no idea what this implies about the standards conformance of OE
or google groups, and I should point out that RFC3977 is quite new, so
there's a high probability that there are some implementations out there
that don't follow it (especially OE I would imagine considering MS's
track record of standards conformance and that OE6 is quite old and
probably just barely maintained).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top