Monday, March 30, 2015

Digest for comp.lang.c++@googlegroups.com - 8 updates in 2 topics

Juha Nieminen <nospam@thanks.invalid>: Mar 30 09:57AM

> Which surprised me. I expected that the program would either
> crash (unhandled exception)
 
Why would it crash? You gave it some bytes and it echoed them back.
What exactly would make it crash? The fact that the bytes just happened
to be in a form specified by some UTF-8 specification makes no
difference. They are just bytes.
 
If you want to interpret the input as UTF-8 in your program, you need
to use some library for that. std::string itself is not enough for
that kind of operation.
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Vir Campestris <vir.campestris@invalid.invalid>: Mar 30 09:42PM +0100

On 29/03/2015 22:03, Paavo Helde wrote:
> files with all valid filenames for this platform. Unfortunately this is
> still very platform-specific. On Windows for example you might need to
> use functions like _wfopen_s() or CreateFileW().
 
I think that means no.
 
By a compression system I meant something like UTF-8. Perhaps not the
best choice of words - sorry.
 
Last time I needed to know this the STL functions all took narrow
strings. That's OK if you know what character set the OS is using, and
the filename can be represented in it.
 
But there was no STL way to say "What's my char set" or "set my char
set" - so you're down to implementation dependent stuff.
 
Andy
Paavo Helde <myfirstname@osa.pri.ee>: Mar 30 04:45PM -0500

Vir Campestris <vir.campestris@invalid.invalid> wrote in
>> example you might need to use functions like _wfopen_s() or
>> CreateFileW().
 
> I think that means no.
 
Literally, it does not mean no, because you can have a narrow codepage in
Windows like Windows-1257 and have filenames with s-caron etc as C++
narrow string filenames which are definitely not US-ASCII.
 
But I think this is not what you asked. I agree this all could work much
better. I think the root reason is that most of OS-es as well as C and
C++ predate the Unicode standard.
 
 
> Last time I needed to know this the STL functions all took narrow
> strings. That's OK if you know what character set the OS is using, and
> the filename can be represented in it.
 
There are only a handful (one?) of STL fuctions which take filenames. And
to be honest, I have never needed the fstream part of STL in professional
work. This is probably because most files I deal with are binary, not
some formatted text, plus fstream does not support file mapping anyway.
So while the current situation is sad, it's all still mostly academic, at
least for me.
 
Cheers
Paavo
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Mar 31 12:32AM +0100

On Mon, 30 Mar 2015 21:42:47 +0100
Vir Campestris <vir.campestris@invalid.invalid> wrote:
[snip]
> But there was no STL way to say "What's my char set" or "set my char
> set" - so you're down to implementation dependent stuff.
 
"What's my char set" and "set my char set" by themselves are
meaningless in the context of file names. There is nothing to say that
the filesystem narrow encoding is the same as a particular machine's
locale narrow encoding, and this is self-evident in the case of network
file systems: for these you take what you are given. A sane
cross-platform distributed system probably restricts itself to ASCII.
In practice, that works fine.
 
The Portable Filename Character Set for POSIX (paragraph 3.276 of the
SUS) is even smaller than that, but that is a minumum requirement. In
practice any modern unix will support practically any narrow encoding
(including ISO-8859 and UTF-8) because it views them as just another
stream of bytes terminated by the NUL character and using '/' as the
directory separator, although the space (' ') is best avoided on
unix-likes because lots of user software isn't designed to handle it.
 
On windows you have other issues arising from the need to map the
narrow character set to the wide character set.
 
Chris
"محمد رجب" <md.rg8910@gmail.com>: Mar 30 08:56AM -0700

write a C++ program to print number of zeros of a series of 10 numbers
entered by the user.
red floyd <no.spam@its.invalid>: Mar 30 09:16AM -0700

On 3/30/2015 8:56 AM, محمد رجب wrote:
> write a C++ program to print number of zeros of a series of 10 numbers
> entered by the user.
 
Your answer may be found here:
 
http://www.cs.rit.edu/~mjh/docs/c++-faq/how-to-post.html#faq-5.2
"Osmium" <r124c4u102@comcast.net>: Mar 30 12:41PM -0600

"???? ???" <md.rg8910@gmail.com> wrote in message
news:ef767427-e67e-4a47-a047-a2fc3208dbd4@googlegroups.com...
> write a C++ program to print number of zeros of a series of 10 numbers
> entered by the user.
 
As I understand it, this is your current status:
 
int main()
{
// I need something here
}
 
That's too vague to expect any help. Make _some_ attempt and post it, even
if you don't actually like what you post.
Christian Gollwitzer <auriocus@gmx.de>: Mar 30 07:48PM +0200

Am 30.03.15 um 17:56 schrieb محمد رجب:
> write a C++ program to print number of zeros of a series of 10 numbers
> entered by the user.
 
No.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: