http://groups.google.com/group/comp.lang.c++?hl=en
comp.lang.c++@googlegroups.com
Today's topics:
* STL list gets cleared randomly - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/c1d9b0f12b6cc65f?hl=en
* SendMessage() function - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/486826046c935170?hl=en
* includes algorithm not working properly on sets of strings - 5 messages, 4
authors
http://groups.google.com/group/comp.lang.c++/t/0e46582a99756035?hl=en
* is LISP the ultimate prgram language? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/90582c87e16a1cd9?hl=en
* pointers as arguments - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/e96194dd825178fc?hl=en
* Binary file IO: Converting imported sequences of chars to desired type - 3
messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/690c45c0197f60ef?hl=en
* buy sell cheap nike shox jordan max air force one tn timberland prada puma
lacoste shoes from china supply - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/1680c2ac2b68a9c6?hl=en
* cheap wholesale discount nike max 87,Nike max 90,nike max 89,nike max 91,
nike max 95,nike max 97 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/71ee0f3a32f7d2a7?hl=en
* Should the 'this' pointer be explicitly used as a rule? - 1 messages, 1
author
http://groups.google.com/group/comp.lang.c++/t/dc65e966f7b73ba3?hl=en
* Why extracting string from stringstream(a) fails? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/515946bf9554ad00?hl=en
* gcc compiler - debuging - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/14527df8006fbb29?hl=en
* File Generation - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/a3dc865319cdfb52?hl=en
==============================================================================
TOPIC: STL list gets cleared randomly
http://groups.google.com/group/comp.lang.c++/t/c1d9b0f12b6cc65f?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Oct 27 2009 11:55 pm
From: Vladimir Jovic
Olumide wrote:
> Hello -
>
> I'm currently debugging a method which among other things, adds items
> to a list. However, every so often the list size gets set to zero
> "midstream". I've taken care not to clear the list, and I've tested
> for a bad alloc exception, but there is none. (I'd post the code, but
> it would take a lot of space.)
>
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8
By creating the minimal example that demonstrate the problem, you are
likely to find the solution.
> Has anyone ever experienced this sort of error? Barring a problem with
> VS .NET 2003 STL implementation, I'm starting to suspect stack
> corruption.
>
This kind of problems are solvable with valgrind (if the stack
corruption is really the problem).
> Alternatively, I'd appreciate some guidance on how to watch the size
> of the list and halt the debugger when it gets resized.
Go step by step, and see when it change the size.
--
Bolje je ziveti sto godina kao bogatun, nego jedan dan kao siromah!
==============================================================================
TOPIC: SendMessage() function
http://groups.google.com/group/comp.lang.c++/t/486826046c935170?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 28 2009 1:47 am
From: "George Carrey"
Thank you and sorry!
==============================================================================
TOPIC: includes algorithm not working properly on sets of strings
http://groups.google.com/group/comp.lang.c++/t/0e46582a99756035?hl=en
==============================================================================
== 1 of 5 ==
Date: Wed, Oct 28 2009 1:51 am
From: "suresh.amritapuri"
Hi,
just look at includes algorithm on two sets of strings. Its not
working correctly.
bool areql(string x, string y)
{
return (x==y); //whatever i write here, i get the same result. != or
< or > why???
}
int main()
{
set<string> coll;
set<string> search;
coll.insert("13");
coll.insert("96");
coll.insert("0");
search.insert("17");
search.insert("937");
// search.insert(7);
// check whether all elements in search are also in coll
if (includes (coll.begin(), coll.end(),
search.begin(), search.end()),areql) {
cout << "all elements of search are also in coll"
<< endl;
}
else {
cout << "not all elements of search are also in coll"
<< endl;
}
}
== 2 of 5 ==
Date: Wed, Oct 28 2009 2:33 am
From: thomas
On Oct 28, 4:51 pm, "suresh.amritapuri" <suresh.amritap...@gmail.com>
wrote:
> Hi,
> just look at includes algorithm on two sets of strings. Its not
> working correctly.
>
> bool areql(string x, string y)
> {
> return (x==y); //whatever i write here, i get the same result. != or
> < or > why???}
>
> int main()
> {
> set<string> coll;
> set<string> search;
> coll.insert("13");
> coll.insert("96");
> coll.insert("0");
>
> search.insert("17");
> search.insert("937");
> // search.insert(7);
> // check whether all elements in search are also in coll
> if (includes (coll.begin(), coll.end(),
> search.begin(), search.end()),areql) {
You have typo errors.
if (includes (coll.begin(), coll.end(), search.begin(), search.end(),
areql) )...
> cout << "all elements of search are also in coll"
> << endl;
> }
> else {
> cout << "not all elements of search are also in coll"
> << endl;
> }
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -
== 3 of 5 ==
Date: Wed, Oct 28 2009 4:50 am
From: Saeed Amrollahi
On Oct 28, 12:33 pm, thomas <freshtho...@gmail.com> wrote:
> On Oct 28, 4:51 pm, "suresh.amritapuri" <suresh.amritap...@gmail.com>
> wrote:
>
>
>
>
>
> > Hi,
> > just look at includes algorithm on two sets of strings. Its not
> > working correctly.
>
> > bool areql(string x, string y)
> > {
> > return (x==y); //whatever i write here, i get the same result. != or
> > < or > why???}
>
> > int main()
> > {
> > set<string> coll;
> > set<string> search;
> > coll.insert("13");
> > coll.insert("96");
> > coll.insert("0");
>
> > search.insert("17");
> > search.insert("937");
> > // search.insert(7);
> > // check whether all elements in search are also in coll
> > if (includes (coll.begin(), coll.end(),
> > search.begin(), search.end()),areql) {
>
> You have typo errors.
>
> if (includes (coll.begin(), coll.end(), search.begin(), search.end(),
> areql) )...
That's right, but the problem is still on.
>
>
>
> > cout << "all elements of search are also in coll"
> > << endl;
> > }
> > else {
> > cout << "not all elements of search are also in coll"
> > << endl;
> > }
>
> > }- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
-- Saeed Amrollahi
== 4 of 5 ==
Date: Wed, Oct 28 2009 4:53 am
From: Saeed Amrollahi
On Oct 28, 11:51 am, "suresh.amritapuri" <suresh.amritap...@gmail.com>
wrote:
> Hi,
> just look at includes algorithm on two sets of strings. Its not
> working correctly.
>
> bool areql(string x, string y)
> {
> return (x==y); //whatever i write here, i get the same result. != or
> < or > why???}
>
> int main()
> {
> set<string> coll;
> set<string> search;
> coll.insert("13");
> coll.insert("96");
> coll.insert("0");
>
> search.insert("17");
> search.insert("937");
> // search.insert(7);
> // check whether all elements in search are also in coll
> if (includes (coll.begin(), coll.end(),
> search.begin(), search.end()),areql) {
> cout << "all elements of search are also in coll"
> << endl;
> }
> else {
> cout << "not all elements of search are also in coll"
> << endl;
> }
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -
Hi Suresh
My two cents ...
If you remove areql function, the program works.
Regards
-- Saeed Amrollahi
== 5 of 5 ==
Date: Wed, Oct 28 2009 6:03 am
From: Gert-Jan de Vos
On Oct 28, 9:51 am, "suresh.amritapuri" <suresh.amritap...@gmail.com>
wrote:
> Hi,
> just look at includes algorithm on two sets of strings. Its not
> working correctly.
>
> bool areql(string x, string y)
> {
> return (x==y); //whatever i write here, i get the same result. != or
> < or > why???}
>
> int main()
> {
> set<string> coll;
> set<string> search;
> coll.insert("13");
> coll.insert("96");
> coll.insert("0");
>
> search.insert("17");
> search.insert("937");
> // search.insert(7);
> // check whether all elements in search are also in coll
> if (includes (coll.begin(), coll.end(),
> search.begin(), search.end()),areql) {
> cout << "all elements of search are also in coll"
> << endl;
> }
> else {
> cout << "not all elements of search are also in coll"
> << endl;
> }
>
> }
Read here what includes() does and what the predicate function should
do:
http://www.cplusplus.com/reference/algorithm/includes
Now try to understand why your program does not produce your expected
result from includes().
Bonus question: would your program still work with the same elements
in two vector<string>?
==============================================================================
TOPIC: is LISP the ultimate prgram language?
http://groups.google.com/group/comp.lang.c++/t/90582c87e16a1cd9?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 28 2009 4:04 am
From: ram@zedat.fu-berlin.de (Stefan Ram)
ram@zedat.fu-berlin.de (Stefan Ram) writes:
>On the other hand, many features today's Lisp programmers
>are fond of, like macros and CLOS, were not a part of the
>classical LISP.
Indeed, there is a paper claiming that Lisp macros were
an »inspiration« for C macros:
»Lisp programmers have long used macros to extend their
language. Indeed, their success has inspired macro
notations for a variety of other languages, such as C
and Java.«
http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-automata-macros/paper.pdf
This influence is neither contradicted nor confirmed by:
»Many other changes occurred around 1972-3, but the most
important was the introduction of the preprocessor,
partly at the urging of Alan Snyder [Snyder 74], but
also in recognition of the utility of the the
file-inclusion mechanisms available in BCPL and PL/I.«
http://cm.bell-labs.com/cm/cs/who/dmr/chist.pdf
It is possible that C macros indeed were influenced by LISP
macros:
(Begin of quote from <20090708210524.743@gmail.com>)
From: Kaz Kylheku <kkylheku@gmail.com>
Newsgroups: comp.lang.lisp,comp.lang.java.programmer
Subject: Re: macros
Date: Fri, 26 Jun 2009 22:30:12 +0000 (UTC)
Message-ID: <20090708210524.743@gmail.com>
(...)
On 2009-06-26, Patricia Shanahan <pats@acm.org> wrote:
> Tim Bradshaw wrote:
>> On 2009-06-26 19:49:35 +0100, "Thomas F. Burdick" <tburdick@gmail.com>
>> said:
>>
>>> You sure about that? I thought that both C-ish macros and the Lisp
>>> MACRO mechanism came about around 1970 or so.
>>
>> The earliest reference I am aware of to Lisp macros is AIM-5, which
>> describes macros for Lisp 1.5 in 1963. The Lisp 1.5 manual does not
>> mention macros. So I'm guessing a date some time in 1963, or possibly a
>> little earlier.
>>
>
>
> The Software Preservation Group web page for Lisp history,
> http://www.softwarepreservation.org/projects/LISP/ has a link to an
> October 22, 1963 paper "MACRO Definition for LISP" by Timothy P. Hart,
> ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-057.pdf
>
> I don't know enough about Lisp to evaluate whether what it describes is
> the foundation of the current Lisp feature. Perhaps someone with the
> necessary knowledge could take a look at it?
It positively, definitely describes the foundations of macros.
(End of quote from <20090708210524.743@gmail.com>)
==============================================================================
TOPIC: pointers as arguments
http://groups.google.com/group/comp.lang.c++/t/e96194dd825178fc?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 28 2009 5:00 am
From: Nick Keighley
On 27 Oct, 01:23, crystal twix <jonwongfanc...@gmail.com> wrote:
re-read my previous post.
> Ok, I seem to be understanding the way you would set up the
> function.
>
> double* computeMaximum(const double* a, const double* b) {
> return((double *)(*a > *b ? a : b));
>
> }
What is the cast for?
> Now I am trying to figure out how to actually call it.
I gave examples.
> My initial guess would be to declare two pointers in main
>
> int *x;
> int *y;
what do x and y point at? What type are they?
<snip>
==============================================================================
TOPIC: Binary file IO: Converting imported sequences of chars to desired type
http://groups.google.com/group/comp.lang.c++/t/690c45c0197f60ef?hl=en
==============================================================================
== 1 of 3 ==
Date: Wed, Oct 28 2009 5:40 am
From: James Kanze
On Oct 26, 5:55 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 26 Okt, 18:06, James Kanze <james.ka...@gmail.com> wrote:
> > On Oct 25, 7:39 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> > > > (but my data sets have generally been very mixed, with a lot
> > > > of non floating point data as well). And binary formatting
> > > > can be more or less expensive as well---I'd rather deal with
> > > > text than a BER encoded double. And Jorgen said very
> > > > explicitly "if you have a choice". Sometimes you don't have
> > > > the choice: you have to conform to an already defined
> > > > external format, or the profiler says you don't have the
> > > > choice.
> > > > > The rule-of-thumb is 30-60 seconds per 100 MBytes of
> > > > > text-formatted FP numeric data, compared to fractions of a
> > > > > second for the same data (natively) binary encoded (just
> > > > > try it).
> > > > Try it on what machine:-).
> > > Any machine. The problem is to decode text-formatted numbers
> > > to binary.
> > You're giving concrete figures.
> Yep. But as rule-of-thumb. My point is not to be accurate (you
> have made a very convincing case why that would be difficult),
> but to point out what performance costs and trade-offs are
> involved when using text-based file fomats.
The problem is that there is no real rule-of-thumb possible.
Machines (and compilers) differ too much today.
> > In terms of concrete numbers, of course... Using time gave
> > me values too small to be significant for 10000000 doubles
> > on the Linux machine (top of the line AMD processor of less
> > than a year ago); for 100000000 doubles, it was around 85
> > seconds for text (written in scientific format, with 17
> > digits precision, each value followed by a new line, total
> > file size 2.4 GB). For 10000000, it was around 45 seconds
> > under Windows (file size 250 MB).
> I suspect you might either have access to a bit more funky
> hardware than most users, or have the skills to fine tune what
> you have better than most users. Or both.
The code was written very quickly, with no tricks or anything.
It was tested on off the shelf PC's---one admittedly older than
those most people are using, the other fairly recent. The
compilers in question were the version of g++ installed with
Suse Linux, and the free download version of VC++. I don't
think that there's anything in there that can be considered
"funky" (except maybe that most people professionally concerned
with high input have professional class machines to do it, which
are out of my price range), and I certainly didn't tune
anything.
> > > > Obviously, the formatting/parsing
> > > > speed will depend on the CPU speed, which varies enormously. By
> > > > a factor of much more than 2 (which is what you've mentionned).
> > > > Again, I've no recent measurements, so I can't be sure, but I
> > > > suspect that the real difference in speed will come from the
> > > > fact that you're writing more bytes with a text format,
> > > This is a factor. Binary files are usually about 20%-70% of the
> > > size of the text file, depending on numbers of significant digits
> > > and other formatting text glyphs. File sizes don't account for the
> > > time 50-100x difference.
> > There is no 50-100x difference. There's at most a difference of
> > 15x, on the machines I've tested; the difference would probably
> > be less if I somehow inhibited the effects of disk caching
> > (because the disk access times would increase);
> Again, your assets might not be representative for the
> average users.
Well, I'm not sure there's such a thing as an average user. But
my machines are very off the shelf, and I'd consider VC++ and
g++ very "average" as well, in the sense that they're what an
average user is most likely to see.
> > > Here is a test I wrote in matlab a few years ago, to
> > > demonstrate the problem (WinXP, 2.4GHz, no idea about disk):
> > I'm afraid it doesn't demonstrate anything to me, because I have
> > no idea how Matlib works. It might be using unbuffered output
> > for text, or synchronizing at each double. And in what format?
> > > The script first generates ten million random numbers,
> > > and writes them to file on both ASCII and binary double
> > > precision floating point formats. The files are then read
> > > straight back in, hopefully eliminating effects of file
> > > caches etc.
> > Actually, reading immediately after writing maximizes the
> > effects of file caches. And on a modern machine, with say 4GB
> > main memory, a small file like this will be fully cached.
> I'll rephrase: Eliminates *variability* due to file caches.
By choosing the best case, which rarely exists in practice.
> Whatever happens affect both files in equal amounts. It would
> bias results if one file was cached and the other not.
What is cached depends on what the OS can fit in memory. In
other words, the first file you wrote was far more likely to be
cached than the second.
> > > The ASCII file in this test is 175 MBytes, while
> > > the binary file is about 78 MBytes.
> > If you're dumping raw data, a binary file with 10000000
> > doubles, on a PC, should be exactly 80 MB.
> It was. The file browser I used reported the file size
> in KBytes. Multiply the number by 1024 and you get
> exactly 80 Mbytes.
Strictly speaking, a KB is exactly 1000 bytes, not 1024:-). But
I know, different programs treat this differently.
> > > The first few lines in the text file look like
> > > -4.3256481e-001
> > > -1.6655844e+000
> > > 1.2533231e-001
> > > 2.8767642e-001
> > > (one leading whitespace, one negative sign or whitespace, no
> > > trailing spaces) which is not excessive, neither with respect
> > > to the number of significant digits, or the number of other
> > > characters.
> > It's not sufficient with regards to the number of digits.
> > You won't read back in what you've written.
> I know. If that was a constraint, file sizes and read/write
> times would increase correspondingly.
It was a constraint. Explicitly. At least in this thread, but
more generally: about the only time it won't be a constraint is
when the files are for human consumption, in which case, I think
you'd agree, binary isn't acceptable.
> > > The timing numbers (both absolute and relative) would be
> > > of similar orders of magnitude if you repeated the test
> > > with C++.
> > I did, and they aren't. They're actually very different in
> > two separate C++ environments.
> > > The application I'm working with would need to crunch
> > > through some 10 GBytes of numerical data per hour. Just
> > > reading that amount of data from a text format would
> > > require on the order of
> > > 1e10/1.75e8*42s = 2400s = 40 minutes.
> > > There is no point in even considering using a text format
> > > for these kinds of things.
> > But it must not be doing much processing on the data, just
> > copying it and maybe a little scaling. My applications do
> > significant calculations (which I'll admit I don't
> > understand, but they do take a lot of CPU time). The time
> > spent writing the results, even in XML, is only a small part
> > of the total runtime.
> The read?
I don't know. It's by some other applications, in other
departments, and I have no idea what they do with the data.
You're probably right, however, that to be accurate, I should do
some comparisons including reading. For various reasons (having
to deal with possible errors, etc.), the CPU overhead when
reading is typically higher than when writing.
But I'm really only disputing your order of magnitude
differences, because they don't correspond with my experience
(nor my measurements). There's definitely more overhead with
text format. The only question is whether that overhead is more
expensive than the cost of the alternatives, and a there depends
on what you're doing. Obviously, if you can't afford the
overhead (and I've worked on applications which couldn't), then
you use binary, but my experience is that a lot of people jump
to binary far too soon, because the overhead isn't that critical
that often.
> > > > > If there are problems with binary floating point I/O formats,
> > > > > then that's a question for the C++ standards committee. It
> > > > > ought to be a simple technical (as opposed to political)
> > > > > matter to specify that binary FP I/O could be set to comply to
> > > > > some already defined standard, like e.g. IEEE 754.
> > > > So that the language couldn't be used on some important
> > > > platforms? (Most mainframes still do not use IEEE. Most don't
> > > > even use binary: IBM's are base 16, and Unisys's base 8.) And
> > > > of course, not all IEEE is "binary compatible" either: a file
> > > > dumped from the Sparcs I've done most of my work on won't be
> > > > readable on the PC's I currently work on.
> > > I can't see how the problem is different from text encoding.
> > > The 7-bit ANSI character set is the baseline. A number of
> > > 8-bit ASCII encodings are in use, and who knows how many
> > > 16-bit encodings. No one says which one should be used. Only
> > > which ones should be available.
> > The current standard doesn't even say that. It only gives a
> > minimum list of characters which must be supported. But I'm
> > not sure what your argument is: you're saying that we should
> > standardize some binary format more than the text format?
> Yep. Some formats. like IEEE 754 (and maybe descendants)
> are fairly universal. No matter what the native formats
> look like, it ought to suffice to call a standard method
> to dump binary data on the format.
To date, neither C nor C++ have made the slightest gest in the
direction of standardizing any binary formats. There are other
(conflicting) standards which do: XDR, for example, or BER. I
personally think that adding a second set of streams, supporting
XDR, to the standard, would be a good thing, but I've never had
the time to actually write up such a proposal. And a general
binary format is quite complex to specify; it's one thing to say
you want to output a table of double, but to be standardized,
you also have to define what is output when a large mix of types
are streamed, and how much information is necessary about the
initial data in order to read them.
> > (The big difference is, of course, is that while the
> > standard doesn't specify any encoding, there are a number of
> > different encodings which are supported on a lot of
> > different machines. Where as a raw dump of double doesn't
> > work even between a PC and a Sparc. Or between an older
> > Mac, with a Power PC, and a newer one, with an Intel chip.
> > Upgrade your machine, and you loose your data.)
> Exactly. Which is why there ought to be a standardized binary
> floating point format that is portable between platforms.
There are several: I've used both XDR and BER in applications in
the past. One of the reasons C++ doesn't address this issue is
that there are several, and C++ doesn't want to choose one over
the others.
--
James Kanze
== 2 of 3 ==
Date: Wed, Oct 28 2009 5:42 am
From: James Kanze
On Oct 26, 9:50 pm, Brian <c...@mailvault.com> wrote:
> On Oct 26, 12:06 pm, James Kanze <james.ka...@gmail.com> wrote:
> I haven't invested in text or XML marshalling because
> I think binary formats are going to prevail.
Which binary format? There are quite a few to choose from.
> With the portability edge taken away from text, there won't be
> much reason to use text.
The main reason to use text is that it's an order of magnitude
easier to debug. And that's not likely to change.
--
James Kanze
== 3 of 3 ==
Date: Wed, Oct 28 2009 7:55 am
From: Rune Allnor
On 28 Okt, 13:40, James Kanze <james.ka...@gmail.com> wrote:
> The code was written very quickly, with no tricks or anything.
Just out of curiosity - would it be possible to see your code?
As far as I can tell, you haven't posted it (If you have, I have
missed it).
Rune
==============================================================================
TOPIC: buy sell cheap nike shox jordan max air force one tn timberland prada
puma lacoste shoes from china supply
http://groups.google.com/group/comp.lang.c++/t/1680c2ac2b68a9c6?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 28 2009 5:55 am
From: vipshoeshop
vipshoeshop Co.,Ltd(www.vipshoeshop.com) wholesale nike jordan
sneakers big cheap air jordan sneakers for sale.discount china nike
dunk sb shoes,nike exclusive jordan sneakers,custom nike air force one
sneakers,nike dunk cheap,nike jordan sneakers wholesale,discount supra
shoes wholesale new balance shoes puma shoes,cheap adidas
shoes,authentic jordan sneakers,wholesale nike max 90 sheos,china
supplier nike max 87 max 2009 max 360 shoes,hot max 95 shoes,free
shipping prada shoes,nike retro jordan snekaers,other nike running
shoes,wholesale nike lebron james 6 sneakers,cheap nike zoom kobe 4
sneakers free shipping, kids jordan sneakers wholesale, nike air force
one 1 fusion jordan sneakers,buy sneaker for cheap,nike air max
premium leather sneakers,gucci tennis shoes for discount,high quality
gucci shoes,wholesale jordan fusion sneakers from china supply,cheap
air bape sneakers, China Nike product manufacturer,gucci shoes,supply
puma sneakers timberland shoes,discounts Jordans kicks shoes Cheap
Discount Basketball Sneakers on Sale, Nike Retro Air Jordan Melo M5,
United States Christian Audigier T-Shirt Wholesale Christian Audigier
T-Shirt New cheap Christian Audigier T-Shirt Manufacturers
Suppliers,Wholesale Ed hardy AF T-Shirt, Discounted Louis Vuitton
Designer Handbags Clothes,Chanel and Coach Designer Handbag Wallets
Purse,Replica Louis Vuitton Handbag Accessories,Cheap Gucci handbags
Designer handbags by Gucci leather Purses Belt sunglasses,nike air
zoom signature basketball shoes,
==============================================================================
TOPIC: cheap wholesale discount nike max 87,Nike max 90,nike max 89,nike max
91,nike max 95,nike max 97
http://groups.google.com/group/comp.lang.c++/t/71ee0f3a32f7d2a7?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 28 2009 5:56 am
From: vipshoeshop
vipshoeshop Co.,Ltd( www.vipshoeshop.com ) wholesale cheap jordan
shoes,buy New arrival nike jordan sneakers,discount nike kids series
shoes,mix jordan sneakers,custom nike sb dunks,gucci tennis shoes for
discount, sell jordan sneakers for men's women's kids,cheap nike
trainers retro shoes,nike dunks premium sb,cheap nike zoom kobe 4
sneakers free shipping wholesale nike dunk sb shoes,Jordan
spiz"ikes,nike factory for authentic brand name sneakers,jordan
spiz'ikes,jordan mixed with air force ones,cheap nike shox
oz,nz,R3,R4,R5,TL2,TL3,TL4,TL5,cheap air force ones outlet,nike
sneakers for sale,discount air max 87,max 90,max 91,max 95,max 97,max
180,max 360,max TN,max LTD,discount nike women sneakers free
shipping,cheap D&G gucci prada chanel shoes timberland boot ugg
kick,discount bape stat shoes for sale.
==============================================================================
TOPIC: Should the 'this' pointer be explicitly used as a rule?
http://groups.google.com/group/comp.lang.c++/t/dc65e966f7b73ba3?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 28 2009 7:27 am
From: Jorgen Grahn
On Tue, 2009-10-27, Juha Nieminen wrote:
> Paavo Helde wrote:
>> Are you talking about data members or member functions? Non-member
>> functions are typically qualified by the namespace, e.g. std::sort(), so I
>> see no urgent need for distinguishing member functions.
>
> Except for functions in a nameless namespace.
>
>> For data members, I have grown a habit to use trailing underscore for all
>> data member names, to distinguish them from local variables and parameters.
>> Less typing than this-> and cannot be forgotten accidentally.
>
> I don't know who first invented that convention, but it seems quite
> popular, and I really can't understand why. IMO an underscore truly
> makes code look more obfuscated than other possible choices. Often you
> have to follow that underscore with a dot or a ->, which makes it confusing.
>
> Personally I have got the habit of preceding member variable names
> with an 'm', constants with a 'k' and "globals" (well, local to the
> current compilation unit) with a 'g'. I have found it does significantly
> improve my own understanding of the code months and years later.
Maybe the difference is in how you spell the rest of your members.
I tend to use old Unix-style naming: all lowercase, words separated by
_, e.g. "collation_bits". A _ suffix works fine for me
(collation_bits_) -- I got used to it quickly.
A 'm' prefix feels (subjectively) less neutral -- it interacts in my
brain with the letters in the actual variable name. m_order makes me
think of murder, etc.
Also, it would in practice mean that I would have to add another _
(m_collation_bits) or go CamelCase (mCollationBits) which looks too
much like Java for my taste.
I'm not arguing strongly for trailing _; I just wanted to add a bit
more perspective. The best would have been if C++ had forced us (like
Python and Smalltalk do: self.collation_bits) but it is much too late
for that now, and this->collation_bits cannot be enforced.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
==============================================================================
TOPIC: Why extracting string from stringstream(a) fails?
http://groups.google.com/group/comp.lang.c++/t/515946bf9554ad00?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 28 2009 7:29 am
From: James Kanze
On Oct 26, 11:02 pm, Maxim Yegorushkin <maxim.yegorush...@gmail.com>
wrote:
> On 26/10/09 17:47, James Kanze wrote:
> > On Oct 26, 4:07 pm, Maxim Yegorushkin<maxim.yegorush...@gmail.com>
> > wrote:
[...]
> >>> The argument passing is defined as copy initialization. And
> >>> in C++98 the implementation is allowed to make any number of
> >>> copies of an rvalue actual argument passed to 'T const&'
> >>> formal argument, or for any copy initialization. Which means
> >>> that the type must provide a suitable copy constructor. For
> >>> example, that means that you can't do this thing with a
> >>> std::auto_ptr. Or a stream.
> >> Even more interesting.
> >> Given the following declaration:
> >> void foo(int& ref);
> >> Could you explain how ref argument can possibly be
> >> copy-initialized please?
> > There's more to it that Alf revealed. (It wouldn't be the
> > C++ standard if it were that simple.) It's copy
> > initialization, so the rules for copy initialization apply.
> > The rule that requires a copy constructor when copy
> > initialization is used only applies when initializing a
> > reference with an rvalue (and this is the only time copies
> > are allowed). If the initializer is an lvalue, everything
> > is fine---otherwise, things like:
> > int i;
> > int& ri = i;
> > would have somewhat unexpected semantics.
> I've been looking at 8.5 Initializers now. My understanding is
> that because that form of initialization which is used for
> function arguments is called copy initialization, it implies
> that a copy constructor is required regardless of whether an
> argument is a reference that can be bound directly.
What part of 8.5 exactly? In §8.5/12,13, it says that the
initializer must be copied, but the initializer here would be
the T&, the reference. (That does have "interesting"
implications concerning the lifetime of temporaries, but I'm
pretty sure that that isn't intentional.) §8.5.3/5 is quite
clear: "[...]-- If the initializer expression [...]-- is an
lvalue[...] then the reference is bound directly to the
initializer expression."
> It also says that copy elision is a permissible optimization,
> but does not require it.
Yes, but since we're talking here about copying the reference, I
don't think that it's too relevant. References are copiable,
regardless of what they refer to. The possible problem
regarding copy is the lifetime of the temporary. Given
something like:
int const& ri = 3;
, the temporary containing the 3 has its lifetime extended to
that of the reference it initializes. If the reference it
initializes is a temporary, which is then copied to initialize
ri, this doesn't help us much.
As I said, I don't think this was intended, and I none of the
compilers I know implement it this way.
> My intuitive expectation is that implied by the spirit of C++:
> you don't pay for what you don't use. Applied to the
> initialization of reference function arguments I would expect
> it to require the copy constructor only when it is actually
> used. Oh, well ;)
You don't want the legality of a program changed by whether the
compiler does some optional optimization or not.
> Alf and Johannes report that initialization of references does
> not require a copy constructor in the C++0x standard. I am
> glad that they elaborated this case :)
I've still got to examine the new text. The reason for the rule
(I think) is for things like:
struct S { A a; B b; }; // A and B class types...
S f();
B const& rb = f().b;
What should be the lifetime of the S returned by f(). I'd argue
that the current text of the standard says that its lifetime
must end at the end of the full expression. But the only way to
end it, while extending the lifetime of the B temporary bound to
rb, is to copy it out of the S object. (A quick read of the
text in N2914---a recent, but perhaps not the latest,
draft---seems a bit ambiguous. None of the enumerated points
seems to cover this case.)
--
James Kanze
==============================================================================
TOPIC: gcc compiler - debuging
http://groups.google.com/group/comp.lang.c++/t/14527df8006fbb29?hl=en
==============================================================================
== 1 of 2 ==
Date: Wed, Oct 28 2009 7:36 am
From: Jorgen Grahn
On Tue, 2009-10-27, Juha Nieminen wrote:
> Jorgen Grahn wrote:
>> Debugging is to me the activity of fixing bugs in general. You can do
>> that by reading the code, inserting printf()s, writing unit tests,
>> running it under strace/valgrind/etc, provoking it in various ways ...
>> or stepping around in a symbolic debugger.
>
> You forgot the liberal use of assert(). I cannot even count how many
> bugs I have caught very early on development thanks to my liberal use of
> assert().
Yeah -- including that one I half-jokingly wanted to have in the
standard library: assume(), hope() or jump_to_conclusion().
(For when you want to assert() something in early prototyping, but
know that you *will* have to handle it seriously later on.)
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
== 2 of 2 ==
Date: Wed, Oct 28 2009 7:37 am
From: James Kanze
On Oct 26, 5:56 pm, jacob navia <ja...@nospam.org> wrote:
> Jorgen Grahn a écrit :
> > On Sun, 2009-10-25, Maxim Yegorushkin wrote:
> >> On 25/10/09 14:51, t wrote:
> >>> How to debuge programc in gcc
> >> You need to use a debugger, such as gdb. Google for "gdb tutorial".
> > Well, he doesn't actually need a debugger to debug.
> > Debugging is to me the activity of fixing bugs in general.
> > You can do that by reading the code, inserting printf()s,
> > writing unit tests, running it under strace/valgrind/etc,
> > provoking it in various ways ... or stepping around in a
> > symbolic debugger.
> > Personally I never learned to enjoy that last kind of
> > debugging, not even in C with its usually simpler call
> > chains. (Although naturally I use gdb for post-mortem
> > debugging of core dumps -- I'm not stupid).
> You never learned to use a debugger?
> If you would have learned, then you would need to do post
> mortem debugging less often...
More likely, you're confusing cause and effect. He's never
learned to use a debugger because he hasn't needed it: some of
the ways he has enumerated (code review, detailed unit tests)
are more effective than a debugger in finding an eliminating
bugs. I know that in situations where good code review and
extensive unit tests are required, almost no one ends up using
the debugger, and in general, I feel that if I need a debugger,
I'm doing something wrong: programming too carelessly, for
example, or not writing detailed enough unit tests. (Typically,
I'll use one once or twice a year, at the most, and I've done
whole projects without one.)
--
James Kanze
==============================================================================
TOPIC: File Generation
http://groups.google.com/group/comp.lang.c++/t/a3dc865319cdfb52?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 28 2009 7:48 am
From: James Kanze
On Oct 27, 8:31 pm, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
> Jonathan Lee wrote:
> > On Oct 27, 1:21 pm, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
> >> <sigh> You've spoiled all the fun for "skywalker"... I hoped the OP
> >> would print those names and figure it out himself.
> > Ha. Sorry. Didn't mean to ruin the surprise :)
> LOL
> > Though to be honest I don't get the whole "hinting at the
> > answer" thing. In person, OK. But on Usenet? I tend to think
> > that when a poster gets a riddle instead of an answer, what
> > they learn is to not bother asking questions here.
> It depends on the person asking the questions. If they are
> inquisitive, naturally curious, they will keep looking, keep
> trying to solve the puzzle. If hints supplied so far aren't
> enough, they will ask for more.
> If they are enough, they will solve the problem. And that's
> what I would like to see in a specialist. Judging from the
> question, the OP is still learning, so it helps them if we
> don't just provide answers but point them in the general
> direction of the solution and let them figure out the details.
There's a difference between "hinting" and "answering with a
riddle". Had the original poster followed up on your hint, he
would have found the error immediately, and in the process,
learned a few other important points, like testing the results
of an operation, and displaying all relevant information in an
error message. And IMHO, if the original poster doesn't have
enough initiative to do that, then he's probably better off in a
different domain. If your answer had really been a riddle, I
could understand Jonathan's objection to it, but IMHO it was
more along the lines of: here's what you should do to find the
answer. IMHO, an excellent and educational response.
--
James Kanze
==============================================================================
You received this message because you are subscribed to the Google Groups "comp.lang.c++"
group.
To post to this group, visit http://groups.google.com/group/comp.lang.c++?hl=en
To unsubscribe from this group, send email to comp.lang.c+++unsubscribe@googlegroups.com
To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c++/subscribe?hl=en
To report abuse, send email explaining the problem to abuse@googlegroups.com
==============================================================================
Google Groups: http://groups.google.com/?hl=en
No comments:
Post a Comment