Sunday, January 24, 2010

comp.lang.c++ - 25 new messages in 11 topics - digest

comp.lang.c++
http://groups.google.com/group/comp.lang.c++?hl=en

comp.lang.c++@googlegroups.com

Today's topics:

* Support for export keyword ? - 4 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/0878ed0c9c1ca584?hl=en
* ۞●۞●۞ Cheap price Wholesale Air Force One Shoes at www.fjrjtrade.com <paypal
payment> - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/2a1ac0c8afd1564f?hl=en
* How to get the distance (hops) between NUMA nodes? - 3 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/b61459ea866da088?hl=en
* ❉♡❉Wholesale cheap Nike AirMax shoes at www.ecyaya.com 【paypal payment】 -
1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/2179218aa5677e3d?hl=en
* Real overload or not ? - 4 messages, 4 authors
http://groups.google.com/group/comp.lang.c++/t/b8c3930fe90b382b?hl=en
* bounded buffer - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/89e05f4408614915?hl=en
* size_t Question - 6 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/d04eb033c399a55c?hl=en
* C++ function argument with 'class' keyword? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/f43dbb9087b23386?hl=en
* system("ls") - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/ea8887c99b1a8b02?hl=en
* ☎ ☞wholesale cheap brands handbags and purse by paypal in www.ecyaya.com - 1
messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/6a30e371eef4d164?hl=en
* I'm a newbie. Is this code ugly? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/f085e44989fab5ef?hl=en

==============================================================================
TOPIC: Support for export keyword ?
http://groups.google.com/group/comp.lang.c++/t/0878ed0c9c1ca584?hl=en
==============================================================================

== 1 of 4 ==
Date: Sat, Jan 23 2010 11:50 pm
From: "io_x"

"Juha Nieminen" <nospam@thanks.invalid> ha scritto nel messaggio
news:hjbs6r$1fbc$1@adenine.netfront.net...
> James Kanze wrote:
>> To instantiate a template at link time, you
>> need to reconstitute the environment of the point of
>> instantiation, which isn't necessarily trivial.
>
> Could you give some examples of the difficulties which pop up with that?
>
> One would think that it wouldn't be so much different as when the
> programmer does the same thing "manually". In other words, when the
> programmer/linker sees that a template is instantiated with type X, the
> programmer/linker goes to the source file where the template is defined
> and adds an explicit instantiation of it for X and then recompiles that
> one object file,

don't know, not i know somthing well, but i have one idea:
for example:

template <typename T> class Image{
public:
unsigned height;
unsigned width;
T* pxs;

Image(int h, int w)
{int i, g;

height=0; width=0; pxs=0;
if(w<=0||h<=0) return;
g =h*sizeof(T);
if(g<=0) return;
g*=w;
if(g<=0) return;
cout << "Size=" << g << "\n";
pxs=(T*) malloc(g);
if(pxs==0) return;
height=h; width=w;
}

~Image(){free(pxs);}

};

has to be compiled like

class Image{
public:
unsigned height;
unsigned width;
generictypeT* pxs; // or char* pxs;

Image(unsigned sizeof_T, int h, int w)
{int i, g;

height=0; width=0; pxs=0;
if(w<=0||h<=0) return;
g =h*sizeof_T;
if(g<=0) return;
g*=w;
if(g<=0) return;
cout << "Size=" << g << "\n";
pxs=(generictypeT*) malloc(g);
if(pxs==0) return;
height=h; width=w;
}
~Image(){free(pxs);}
}

and the compiler has to use the funtions in this way
Image<double> g(768, 1024);
call the constructor:

Image(sizeof(double), 768, 1024)

so all the routines that use the generic type
(that has to use sizeof(T)) can be ok
like above if pass sizeof(T)


> and that's about it. It just sounds like all the linker
> needs is to call the compiler to compile the necessary object file,
> telling the compiler "and instantiate this template for X". Then the
> compiler does that, and the linker proceeds with the new object file as
> normal.
>
> (Of course this ties the linker tightly to the compiler, removing
> their current separation and independence, but... who actually uses this
> separation nowadays, really? Most compilers are also their own linkers
> at the same time.)
>
> --- news://freenews.netfront.net/ - complaints: news@netfront.net ---

== 2 of 4 ==
Date: Sun, Jan 24 2010 1:35 am
From: "io_x"

"io_x" <a@b.c.invalid> ha scritto nel messaggio
news:4b5bf9f5$0$823$4fafbaef@reader5.news.tin.it...
>
> "Juha Nieminen" <nospam@thanks.invalid> ha scritto nel messaggio
> news:hjbs6r$1fbc$1@adenine.netfront.net...
>> James Kanze wrote:
>>> To instantiate a template at link time, you
>>> need to reconstitute the environment of the point of
>>> instantiation, which isn't necessarily trivial.
>>
>> Could you give some examples of the difficulties which pop up with that?
>>
>> One would think that it wouldn't be so much different as when the
>> programmer does the same thing "manually". In other words, when the
>> programmer/linker sees that a template is instantiated with type X, the
>> programmer/linker goes to the source file where the template is defined
>> and adds an explicit instantiation of it for X and then recompiles that
>> one object file,
>
> don't know, not i know somthing well, but i have one idea:
> for example:
>
> template <typename T> class Image{
> public:
> unsigned height;
> unsigned width;
> T* pxs;
>
> Image(int h, int w)
> {int i, g;
>
> height=0; width=0; pxs=0;
> if(w<=0||h<=0) return;
> g =h*sizeof(T);
> if(g<=0) return;
> g*=w;
> if(g<=0) return;
> cout << "Size=" << g << "\n";
> pxs=(T*) malloc(g);
> if(pxs==0) return;
> height=h; width=w;
> }
>
> ~Image(){free(pxs);}
>
> };
>
> has to be compiled like
>
> class Image{
> public:
> unsigned height;
> unsigned width;
> generictypeT* pxs; // or char* pxs;
>
> Image(unsigned sizeof_T, int h, int w)

Image(unsigned* arg, unsigned* argsz, int h, int w)
where arg[0]==sizeof_T
we know that the element0_ofT has address == &T
arsz[0]==sizeof(element_0ofT)
arg[1]==offsetof(element_1ofT) arsz[1]==sizeof(element_1ofT)
arg[2]==offsetof(element_2ofT) arsz[2]==sizeof(element_2ofT)
etc etc
arg[n-1]==offsetof(element_n-1ofT) arsz[n-1]==sizeof(element_n-1ofT)
arg[n] == 0 // for see the end put 0
// the elements of struct are 0..n-1
> {int i, g;
>
> height=0; width=0; pxs=0;
> if(w<=0||h<=0) return;
> g =h*sizeof_T;
> if(g<=0) return;
> g*=w;
> if(g<=0) return;
> cout << "Size=" << g << "\n";
> pxs=(generictypeT*) malloc(g);
> if(pxs==0) return;
> height=h; width=w;
> }
> ~Image(){free(pxs);}
> }
>
> and the compiler has to use the funtions in this way
> Image<double> g(768, 1024);
> call the constructor:
>
> Image(sizeof(double), 768, 1024)

unsigned p[]={sizeof(double), 0}, q[]={sizeof(double), 0}

Image(p, q, 768, 1024);

> so all the routines that use the generic type
> (that has to use sizeof(T)) can be ok
> like above if pass sizeof(T)
>
>
>> and that's about it. It just sounds like all the linker
>> needs is to call the compiler to compile the necessary object file,
>> telling the compiler "and instantiate this template for X". Then the
>> compiler does that, and the linker proceeds with the new object file as
>> normal.
>>
>> (Of course this ties the linker tightly to the compiler, removing
>> their current separation and independence, but... who actually uses this
>> separation nowadays, really? Most compilers are also their own linkers
>> at the same time.)
>>
>> --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
>
>
>


== 3 of 4 ==
Date: Sun, Jan 24 2010 9:25 am
From: Juha Nieminen


io_x wrote:
> and the compiler has to use the funtions in this way
> Image<double> g(768, 1024);
> call the constructor:
>
> Image(sizeof(double), 768, 1024)
>
> so all the routines that use the generic type
> (that has to use sizeof(T)) can be ok
> like above if pass sizeof(T)

I don't think you understand how export templates work. Export
templates are no different from regular templates. They are not (and
cannot be) compiled to object files prior to their actual instantiation.
They are compiled *after* they have been instantiated, just like regular
templates.

Yes, the linker stage has to call the C++ compiler in order to
instantiate export templates with the proper types, after which they are
compiled more or less like regular templates.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---


== 4 of 4 ==
Date: Sun, Jan 24 2010 9:37 am
From: Juha Nieminen


James Kanze wrote:
>> Could you give some examples of the difficulties which pop up
>> with that?
>
> Could you explain to me why you think it is so simple.

Because you can emulate export templates to a degree with manual
instantiation.

In other words, in the header file you can simply have the declaration
of the template class or template function (ie. not its definition), and
then in a source file you can implement the definition and then in that
file instantiate it manually for each type with which the template is
being used in the program.

I have done that in practice and it works.

>> One would think that it wouldn't be so much different as when
>> the programmer does the same thing "manually".
>
> The programmer never does the same thing manually. To do so
> would be too difficult.

It's quite simple to do, at least for simple template types. For example:

//-----------------------------------------------------------------
// EmulatedExportTemplateClass.hh
template<typename Value_t>
class EmulatedExportTemplateClass
{
Value_t value;

public:
EmulatedExportTemplateClass(const Value_t&);
const Value_t& getValue() const;
};
//-----------------------------------------------------------------

//-----------------------------------------------------------------
// EmulatedExportTemplateClass.cc
#include "EmulatedExportTemplateClass.hh"

template<typename Value_t>
EmulatedExportTemplateClass<Value_t>::EmulatedExportTemplateClass
(const Value_t& v):
value(v)
{}

template<typename Value_t>
const Value_t& EmulatedExportTemplateClass<Value_t>::getValue() const
{
return value;
}

// Manual "export" template instantiation:
template class EmulatedExportTemplateClass<int>;
template class EmulatedExportTemplateClass<double>;
//-----------------------------------------------------------------

//-----------------------------------------------------------------
// main.cc
#include "EmulatedExportTemplateClass.hh"
#include <iostream>

int main()
{
EmulatedExportTemplateClass<int> intVal(10);
EmulatedExportTemplateClass<double> doubleVal(2.5);
std::cout << intVal.getValue() << " " << doubleVal.getValue()
<< std::endl;
}
//-----------------------------------------------------------------

>> In other words, when the programmer/linker sees that a
>> template is instantiated with type X, the programmer/linker
>> goes to the source file where the template is defined and adds
>> an explicit instantiation of it for X and then recompiles that
>> one object file, and that's about it.
>
> Except that the results won't compile.

The above example compiles at least with gcc and Visual C++.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

==============================================================================
TOPIC: ۞●۞●۞ Cheap price Wholesale Air Force One Shoes at www.fjrjtrade.com <
paypal payment>
http://groups.google.com/group/comp.lang.c++/t/2a1ac0c8afd1564f?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 24 2010 12:18 am
From: "www.fjrjtrade.com"


۞●۞●۞ Cheap price Wholesale Air Force One Shoes at www.fjrjtrade.com
<paypal payment>


Welcome to visit www.fjrjtrade.com


Cheap Wholesale Air Force One Shoes

Wholesale Air Force One Shoes (paypal payment)

http://www.fjrjtrade.com/916-Air-Force-one.html

Wholesale Air Force One 25 Men (paypal payment)

http://www.fjrjtrade.com/1627-Air-Force-one-25%28M%29.html

Wholesale Air Force One Children (paypal payment)

http://www.fjrjtrade.com/1629-Air-force-One-Children.html

Wholesale Air Force One low (paypal payment)

http://www.fjrjtrade.com/1630-Air-Force-one%28low%29.html

Wholesale Air Force One M&W (paypal payment)

http://www.fjrjtrade.com/1631-Air-Force-One%28MW%29.html

Wholesale Air Force One Mid (paypal payment)

http://www.fjrjtrade.com/1632-Air-Force-one%28Mid%29.html

Wholesale Air Force One Mid Men (paypal payment)

http://www.fjrjtrade.com/1771-Air-Force-one-Mid-Man.html

Wholesale Air Force One Mid Women (paypal payment)

http://www.fjrjtrade.com/1772-Air-Force-one-Mid-Women.html

Wholesale Air Force One Women (paypal payment)

http://www.fjrjtrade.com/1633-Air-Force-One%28W%29.html

Website:
http://www.fjrjtrade.com

==============================================================================
TOPIC: How to get the distance (hops) between NUMA nodes?
http://groups.google.com/group/comp.lang.c++/t/b61459ea866da088?hl=en
==============================================================================

== 1 of 3 ==
Date: Sun, Jan 24 2010 12:29 am
From: ttt


On 24 ian., 02:29, Branimir Maksimovic <bm...@hotmail.com> wrote:
> ttt wrote:
> > Hi! Maybe this is not the best place to ask this kind of questions,
> > but...
>
> > I'm working on a memory allocator that should be optimized for use on
> > NUMA architectures. It tries to take memory from the node where the
> > current thread resides, and if it can't find there, it "steals" from
> > other nodes.
>
> ...
>
> > Is there any way to get the distance between nodes ? It must not be
> > necessarily an API, CPUID/APIC would be very good if there is no other
> > way.
>
> > Thanks in advance!
>
> I think that numa api is always os specific. For example on linux
> you have libnuma, that is, api for kernel numa support.
>
> http://manpages.ubuntu.com/manpages/intrepid/man3/numa.3.html
>
> Greets

Thanks. libnuma has a 'distance' function which does what I want. But
I'm more interested in support for Windows.
I've found a new function that appeared in Win7 GetNumaProximityNode
but I couldn't understand from the documentation how it's supposed to
work. Has anyone used this function ?


== 2 of 3 ==
Date: Sun, Jan 24 2010 1:34 am
From: s


Hi,

You might want to look at this link (though for x64):

http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/

Bye,
ttt wrote:
> Is there any way to get the distance between nodes ? It must not be
> necessarily an API, CPUID/APIC would be very good if there is no other
> way.


== 3 of 3 ==
Date: Sun, Jan 24 2010 3:35 am
From: ttt


On 24 ian., 11:34, s <die9...@gmail.com> wrote:
> Hi,
>
> You might want to look at this link (though for x64):
>
> http://software.intel.com/en-us/articles/intel-64-architecture-proces...
>
> Bye,
>
>
>
> ttt wrote:
> > Is there any way to get the distance between nodes ? It must not be
> > necessarily an API, CPUID/APIC would be very good if there is no other
> > way.

I have found a solution for Windows (though not tested yet). The
distance can be found in the SLIT - System Locality Information Table
- an extensions provided by OEMs and available through ACPI. It
contains a nCpu x nCpu matrix that describes the distances. Windows
Vista+ has the method GetSystemFirmwareTable that can be used to
retrieve this table (and under XP it seems that it can be retrieved
from the Registry, but it's more difficult). The structure of this
table can be found in the ACPICA package (http://www.acpica.org).

==============================================================================
TOPIC: ❉♡❉Wholesale cheap Nike AirMax shoes at www.ecyaya.com 【paypal payment

http://groups.google.com/group/comp.lang.c++/t/2179218aa5677e3d?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 24 2010 12:35 am
From: hero


❉♡❉Wholesale cheap Nike AirMax shoes at www.ecyaya.com 【paypal
payment】


AirMax 87 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-461-b0-Nike-Air-Max-87.html
AirMax 87 (M&W) at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-466-b0-Nike-Air-Max-87-MW.html
AirMax 87(M) at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-464-b0-Nike-Air-Max-87-Man.html
AirMax 87(W) at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-465-b0-Nike-Air-Max-87-Women.html
AirMax 89 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-467-b0-Nike-Air-Max-89.html
AirMax 90 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-468-b0-Nike-Air-Max-90.html
AirMax 90 Current Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-469-b0-Nike-Air-Max-90-Current-Man.html
AirMax 90(M) at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-470-b0-Nike-Air-Max-90-Man.html
AirMax 90(W) at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-471-b0-Nike-Air-Max-90-Women.html
AirMax 90 Man Hight at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-472-b0-Nike-Air-Max-90-Man-Hight.html
AirMax 90 Kid at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-520-b0-Nike-Air-Max-90-Kid.html
AirMax 91 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-474-b0-Nike-Air-Max-91.html
AirMax 91 Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-475-b0-Nike-Air-Max-91-Man.html
AirMax 91 Woman at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-476-b0-Nike-Air-Max-91-Women.html
AirMax92 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-477-b0-Nike-Air-Max-92.html
AirMax 93 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-478-b0-Nike-Air-Max-93.html
AirMax 95 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-479-b0-Nike-Air-Max-95.html
AirMax 95 Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-480-b0-Nike-Air-Max-95-Man.html
AirMax 95 Woman at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-481-b0-Nike-Air-Max-95-Women.html
AirMax 95 Kid at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-521-b0-Nike-Air-Max-95-Kid.html
AirMax 97 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-483-b0-Nike-Air-Max-97.html
AirMax 97 Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-484-b0-Nike-Air-Max-97-Man.html
AirMax 97 Woman at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-485-b0-Nike-Air-Max-97-Women.html
AirMax 180 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-486-b0-Nike-Air-Max-180.html
AirMax 2006 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-487-b0-Nike-Air-Max-2006.html
AirMax 2006 1era man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-488-b0-Nike-Air-Max-2006-1era-Man.html
AirMax 2006 1era Woman at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-489-b0-Nike-Air-Max-2006-1era-Women.html
AirMax 2006 1era M&W at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-490-b0-Nike-Air-Max-2006-1era-MW.html
AirMax 2006 2era man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-491-b0-Nike-Air-Max-2006-Man-2era.html
AirMax 2006 3era man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-492-b0-Nike-Air-Max-2006-3era-Man.html
AirMax 2006 3era Women at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-493-b0-Nike-Air-Max-2006-3era-Women.html
AirMax 2009 at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-494-b0-Nike-Air-Max-2009.html
AirMax 2009 Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-495-b0-Nike-Air-Max-2009-Man.html
AirMax 2009 Women at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-496-b0-Nike-Air-Max-2009-Women.html
AirMax 2009 2era Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-1365-b0-Nike-Air-Max-2009-2era-Man.html
AirMax 2009 2era Women at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-1366-b0-Nike-Air-Max-2009-2era-Women.html
AirMax Classic BW at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-497-b0-Nike-Air-Max-Clssic-BW.html
AirMax LTD at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-498-b0-Nike-Air-Max-LTD.html
AirMax LTD Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-499-b0-Nike-Air-Max-LTD-Man.html
AirMax LTD Women at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-500-b0-Nike-Air-Max-LTD-Women.html
AirMax LTD Kid at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-522-b0-Nike-Air-Max-LTD-Kid.html
AirMax LTD 2era Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-502-b0-Nike-Air-Max-LTD-2era-Man.html
AirMax LTD 2era Women at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-503-b0-Nike-Air-Max-LTD-2era-Women.html
AirMax Skyline at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-504-b0-Nike-Air-Max-Skyline.html
AirMax Skyline Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-505-b0-Nike-Air-Max-Skyline-Man.html
AirMax Skyline Women at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-506-b0-Nike-Air-Max-Skyline-Women.html
AirMax STAB at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-507-b0-Nike-Air-Max-STAB.html
AirMax Tailwind at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-508-b0-Nike-Air-Max-Tailwind.html
AirMax TN at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-509-b0-Nike-Air-Max-TN.html
AirMax TN Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-510-b0-Nike-Air-Max-TN-Man.html
AirMax TN Women at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-511-b0-Nike-Air-Max-TN-Women.html
AirMax TN Kid at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-523-b0-Nike-Air-Max-TN-Kid.html
AirMax TN8 Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-512-b0-Nike-Air-Max-TN8-Man.html ]
AirMax TN8 Women at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-513-b0-Nike-Air-Max-TN8-Women.html
AirMax TN10 Man at www.ecyaya.com 【paypal payment】
http://www.ecyaya.com/category-514-b0-Nike-Air-Max-TN10-Man.html

==============================================================================
TOPIC: Real overload or not ?
http://groups.google.com/group/comp.lang.c++/t/b8c3930fe90b382b?hl=en
==============================================================================

== 1 of 4 ==
Date: Sun, Jan 24 2010 3:12 am
From: Michael Tsang


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Öö Tiib wrote:

> My opinion is that passing non-const reference is bad practice unless
> the class under question is container-like or pointer-like. With
> container-like their rule is also bad since it causes a member named
> 'rat':
Bad practice? I think it is good if the function modifies the arguments.

e.g.

template<class t>void swap(t &a, t &b) {
t &&c = std::move(a);
a = std::move(b);
b = std::move(c);
}

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAktcKwUACgkQm4klUUKw07AGTwCdGPa9qXuqqpV9vn4VMvsRQVyE
fW0AnRoPMD690Okp++3keyX7p37jf/jI
=yFK8
-----END PGP SIGNATURE-----

== 2 of 4 ==
Date: Sun, Jan 24 2010 3:53 am
From: Abhishek Padmanabh


On Jan 22, 5:20 pm, Christophe Bourez <bou...@gmail.com> wrote:
> Hi,
>
> I am reviewing the coding guideline of an organisation and one of them
> states that the name of the function members should start with an 'r'
> if the function returns a non-const reference (I don't want to debate
> whether returning a non-const ref is a good practice or not). Here
> follows an example
>
> class A
> {
> public:
>     int &rGetValue();
>     const int &GetValue() const;
> ...
>
> };
>
> Clearly, without the 'r', const and non const versions of GetValue
> should have been considered as an overload . Prefixing the 'r' makes
> obviously these member functions not real overload. Personally, I
> really hate this kind of rule, but it is just a matter of taste. Could
> you give me good reasons to prefer a real overload? For example, could
> this kind of rule prevent the reuse of generic code, by the fact that
> their names are not aligned?

It would cause the user of the class to be aware of the const-ness of
the object if he wants to make changes to the reference to the member
returned by calling the non-const version. Which means:

//consider you have an object of A named a
//I would need to have:
int & ref = a.rGetValue();

Irrespective of a being const or non-const, the const member function
gets called.

It would not affect generic code, because if it is possible to achieve
the functionality with the const version, you really don't need to
have the non-const function to be called. Which means, if there is a
function like:

void f(const A& a)
{
a.GetValue();
}

a.GetValue() would be sufficient even though the input object for f()
is a const A or a non-const A. But, this is a very different naming
convention you have. May be, the intention was to be able to identify
the locations where the non-const reference to the member was being
returned without going into the debate around if returning a non-const
reference to a member is good or bad. And may be, to prevent
accidentally, getting back a non-const reference to a member and then
the user code accidentally changing it directly or indirectly, while
with the convention, any such change would happen by an explicit call
to rGetValue like members and in those case the user code is fully
aware of what its doing.


== 3 of 4 ==
Date: Sun, Jan 24 2010 6:21 am
From: Öö Tiib


On Jan 24, 1:12 pm, Michael Tsang <mikl...@gmail.com> wrote:
> Öö Tiib wrote:
> > My opinion is that passing non-const reference is bad practice unless
> > the class under question is container-like or pointer-like. With
> > container-like their rule is also bad since it causes a member named
> > 'rat':
>
> Bad practice? I think it is good if the function modifies the arguments.
>
> e.g.
>
> template<class t>void swap(t &a, t &b) {
>         t &&c = std::move(a);
>         a = std::move(b);
>         b = std::move(c);
>
> }
>

Yes, i was mistyping 'passing'. I meant member function 'returning'
non-const references. Sorry, bad English.


== 4 of 4 ==
Date: Sun, Jan 24 2010 7:24 am
From: SG


On 24 Jan., 12:12, Michael Tsang wrote:
>
> template<class t>void swap(t &a, t &b) {
>         t &&c = std::move(a);
>         a = std::move(b);
>         b = std::move(c);
> }

...is perfectly valid C++ and doesn't invoke undefined behaviour. But
it also doesn't do what you want. In your case "c" is just another
alias of object "a" refers to. It should have been

t c {std::move(a)};

As for const-overloading, I believe the upcoming C++ standard will add
"cbegin" and "cend" to all container classes so you can easily get
const_iterators from a non-const container. So, it seems it's not
*that* bad.

Cheers,
SG

==============================================================================
TOPIC: bounded buffer
http://groups.google.com/group/comp.lang.c++/t/89e05f4408614915?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Jan 24 2010 3:47 am
From: "Larry"


"Yu Han" <hanjunyu@163.com> ha scritto nel messaggio
news:hjgica$2snc$1@adenine.netfront.net...

> // all code are in the server
> // all locks are omitted
> struct Buffer
> { ... };
>
> list<Buffer*> clients;
>
> unsigned int copyBuffer(void*)
> {
> while (1)
> {
> // read data from producer
> // copy data to every client in the list
> }
> }

wow that seems a great step into the right direction! Yet, why you think I
should prefer <list> over <vector> ??

Also, I'm in two minds whether I should delete the chunk from the buffer
after reading it or just read it and let the "Producer" overwrite it
eventually. (is this circular buffer?)

so that when a client connects a new buffer is being pushed_back into the
vector...then the producer will write to all the buffers in vector.

== 2 of 2 ==
Date: Sun, Jan 24 2010 5:59 am
From: Yu Han


On 01/24/2010 07:47 PM, Larry wrote:
> "Yu Han" <hanjunyu@163.com> ha scritto nel messaggio
> news:hjgica$2snc$1@adenine.netfront.net...
>
>> // all code are in the server
>> // all locks are omitted
>> struct Buffer
>> { ... };
>>
>> list<Buffer*> clients;
>>
>> unsigned int copyBuffer(void*)
>> {
>> while (1)
>> {
>> // read data from producer
>> // copy data to every client in the list
>> }
>> }
>
> wow that seems a great step into the right direction! Yet, why you think
> I should prefer <list> over <vector> ??
use what is suitable, not what I/you prefer. In fact, it's possible that
neither is suitable.
>
> Also, I'm in two minds whether I should delete the chunk from the buffer
> after reading it or just read it and let the "Producer" overwrite it
> eventually. (is this circular buffer?)
Maybe a circular buffer is better, maybe...
>
> so that when a client connects a new buffer is being pushed_back into
> the vector...then the producer will write to all the buffers in vector.
>

I don't know all the things about your application. You should make
decision according to your situation. Then, try, test and tune it.

--
Yu Han

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

==============================================================================
TOPIC: size_t Question
http://groups.google.com/group/comp.lang.c++/t/d04eb033c399a55c?hl=en
==============================================================================

== 1 of 6 ==
Date: Sun, Jan 24 2010 6:49 am
From: "Leigh Johnston"


"James Kanze" <james.kanze@gmail.com> wrote in message
news:7dee3511-bace-4973-b915-8fd7666a139a@a22g2000yqc.googlegroups.com...
> On Jan 23, 7:10 am, "io_x" <a...@b.c.invalid> wrote:
>> "Immortal Nephi" <Immortal_Ne...@hotmail.com> ha scritto nel
>> messaggionews:8d88539d-ac35-45a4-bdd3-9ebdc5023165@p24g2000yqm.googlegroups.com...
>
> [...]
>> size_t has one range that allow all possible address
>
> No. All that is required is that it can hold the size of the
> largest possible object. I've used systems with 32 bit
> addresses but 16 bit size_t. (I suspect that most people my age
> has, since this was the case on the most widespread machines
> twenty-five or thirty years ago.)
>

size_t is also used for array indexing so on a 64bit system for example it
should be the same size as ptrdiff_t. consider
std::vector::operator[](size_type), size_type is std::size_t for default
std::allocator. If you can allocate >2^32 chars then you need to be able to
access them via [] also.

/Leigh

== 2 of 6 ==
Date: Sun, Jan 24 2010 6:54 am
From: "Leigh Johnston"


From C ISO standard rationale:

"Thus size_t is also a convenient type for array sizes, and is so used in
several library
30 functions."

For array of char size_t must therefore be same size as ptrdiff_t.

/Leigh

== 3 of 6 ==
Date: Sun, Jan 24 2010 7:05 am
From: "Leigh Johnston"


>
> For array of char size_t must therefore be same size as ptrdiff_t.
>

Unless we are talking about crappy corner case implementations that Mr Kanze
likes so much. What is the point of having a 64bit address space if you can
only allocate 32bits worth of objects/arrays?

/Leigh

== 4 of 6 ==
Date: Sun, Jan 24 2010 10:34 am
From: Öö Tiib


On Jan 24, 5:05 pm, "Leigh Johnston" <le...@i42.co.uk> wrote:
> > For array of char size_t must therefore be same size as ptrdiff_t.
>
> Unless we are talking about crappy corner case implementations that Mr Kanze
> likes so much.  What is the point of having a 64bit address space if you can
> only allocate 32bits worth of objects/arrays?

Because it may be is optimal/required by platform architecture that
does not let one to have continuous memory block over 4 Gigabytes. C
is meant to be as close to assembler as any platform independent
language can get and size_t is C not C++ typedef. You may think it
makes it difficult to program, but it may prove to be best and
quickest and so users will buy it. At second thought it may even sound
reasonable. How often you deal with single object that does not fit
into 4 gigabytes?


== 5 of 6 ==
Date: Sun, Jan 24 2010 10:45 am
From: "Leigh Johnston"


"�� Tiib" <ootiib@hot.ee> wrote in message
news:d20fadd7-fdd9-48bd-a39e-be9b41997f28@b10g2000yqa.googlegroups.com...
> On Jan 24, 5:05 pm, "Leigh Johnston" <le...@i42.co.uk> wrote:
>> > For array of char size_t must therefore be same size as ptrdiff_t.
>>
>> Unless we are talking about crappy corner case implementations that Mr
>> Kanze
>> likes so much. What is the point of having a 64bit address space if you
>> can
>> only allocate 32bits worth of objects/arrays?
>
> Because it may be is optimal/required by platform architecture that
> does not let one to have continuous memory block over 4 Gigabytes. C
> is meant to be as close to assembler as any platform independent
> language can get and size_t is C not C++ typedef. You may think it
> makes it difficult to program, but it may prove to be best and
> quickest and so users will buy it. At second thought it may even sound
> reasonable. How often you deal with single object that does not fit
> into 4 gigabytes?

A single object might need to fit into 4 gigabytes however an array of such
objects might not. The difference between a single object or an array of
objects should not important as far as pointer arithmetic is concerned.

/Leigh

== 6 of 6 ==
Date: Sun, Jan 24 2010 1:14 pm
From: Öö Tiib


On Jan 24, 8:45 pm, "Leigh Johnston" <le...@i42.co.uk> wrote:
> " Tiib" <oot...@hot.ee> wrote in message
>
> news:d20fadd7-fdd9-48bd-a39e-be9b41997f28@b10g2000yqa.googlegroups.com...
>
>
>
>
>
> > On Jan 24, 5:05 pm, "Leigh Johnston" <le...@i42.co.uk> wrote:
> >> > For array of char size_t must therefore be same size as ptrdiff_t.
>
> >> Unless we are talking about crappy corner case implementations that Mr
> >> Kanze
> >> likes so much.  What is the point of having a 64bit address space if you
> >> can
> >> only allocate 32bits worth of objects/arrays?
>
> > Because it may be is optimal/required by platform architecture that
> > does not let one to have continuous memory block over 4 Gigabytes. C
> > is meant to be as close to assembler as any platform independent
> > language can get and size_t is C not C++ typedef. You may think it
> > makes it difficult to program, but it may prove to be best and
> > quickest and so users will buy it. At second thought it may even sound
> > reasonable. How often you deal with single object that does not fit
> > into 4 gigabytes?
>
> A single object might need to fit into 4 gigabytes however an array of such
> objects might not.  The difference between a single object or an array of
> objects should not important as far as pointer arithmetic is concerned.

Yes that was what i was asking. Array is single object like any other.
How often you needed 4GB array? With array it is simpler matter to
solve on such platform since you can have array of pointers to its
elements.

==============================================================================
TOPIC: C++ function argument with 'class' keyword?
http://groups.google.com/group/comp.lang.c++/t/f43dbb9087b23386?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 24 2010 8:29 am
From: Pete Becker


James Kanze wrote:
> On Jan 23, 2:34 pm, Pete Becker <p...@versatilecoding.com> wrote:
>
>> The difference is that without more, the first is valid and
>> the second isn't. In order for the second one to compile there
>> has to be a previous declaration of A.
>
>> bool test(A &mya); // error: A not defined
>> bool test(class A &mya); // OK: A names a class
>
> IIRC, it's more subtle than that. The second names a class in
> function prototype scope.

Sigh. See below:

>
>> On the other hand, the declaration within a function prototype
>> only applies within the prototype:
>
>> bool test(class A& mya); // OK
>> bool also_test(A& may); // error: A not defined
>

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of
"The Standard C++ Library Extensions: a Tutorial and Reference"
(www.petebecker.com/tr1book)

==============================================================================
TOPIC: system("ls")
http://groups.google.com/group/comp.lang.c++/t/ea8887c99b1a8b02?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 24 2010 9:40 am
From: Juha Nieminen


Matko wrote:
> Is there a better way to get data returned by 'ls' command instead of
> 'system("ls > file.txt");' and then reading the file. I'm thinking of
> something that would return 'const char *' into my buffer.

What you want is this:

http://www.boost.org/doc/libs/1_41_0/libs/filesystem/doc/index.htm

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

==============================================================================
TOPIC: ☎ ☞wholesale cheap brands handbags and purse by paypal in www.ecyaya.
com
http://groups.google.com/group/comp.lang.c++/t/6a30e371eef4d164?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 24 2010 9:46 am
From: hero


☎ ☞wholesale cheap brands handbags and purse by paypal in www.ecyaya.com

wholesale cheap Balenciaga Handbags or purse (www.ecyaya.com) (free
shipping)

wholesale cheap Burberry Handbags or purse (www.ecyaya.com)

wholesale cheap Chanel Handbags or purse (www.ecyaya.com) (free
shipping)

wholesale cheap Chloe Handbags or purse

wholesale cheap Christian Audigier Handbags or purse (www.ecyaya.com)

wholesale cheap Coach Handbags or purse (www.ecyaya.com) (free
shipping)

wholesale cheap D&G Handbags or purse (www.ecyaya.com)

wholesale cheap Dooney&Bourke Handbags or purse (www.ecyaya.com) (free
shipping)

wholesale cheap ED Hardy Handbags or purse (www.ecyaya.com)

wholesale cheap Fendi Handbags or purse (www.ecyaya.com) (free
shipping)

wholesale cheap Gucci Handbags or purse (www.ecyaya.com)

wholesale cheap GUSS Handbags or purse (www.ecyaya.com) (free
shipping)

wholesale cheap Hermas Handbags or purse (www.ecyaya.com)

wholesale cheap JIMMY CHOO Handbags or purse (www.ecyaya.com) (free
shipping)

wholesale cheap Juicy Handbags or purse (www.ecyaya.com)

wholesale cheap LV Handbags or purse (www.ecyaya.com) (free shipping)

wholesale cheap Miu Miu Handbags or purse (www.ecyaya.com)

wholesale cheap Prada Handbags or purse (www.ecyaya.com) (free
shipping)

vcheap Versace Handbags or purse (www.ecyaya.com)


wholesale cheap AAA BAG Handbags in www.ecyaya.com(free shipping)

wholesale cheap AAA Chanel Purse in www.ecyaya.com

wholesale cheap AAA Dior Handbags in www.ecyaya.com(free shipping)

wholesale cheap AAA LV Handbags in www.ecyaya.com

wholesale cheap AAA Balenciaga Handbags in www.ecyaya.com(free
shipping)

wholesale cheap AAA Chloe Handbags in www.ecyaya.com

wholesale cheap AAA Giorgio Armani Purse in www.ecyaya.com
(free shipping)
wholesale cheap AAA LV Purse in www.ecyaya.com

wholesale cheap AAA Balenciaga Purse in www.ecyaya.com(free shipping)

wholesale cheap AAA Chloe Purse in www.ecyaya.com

wholesale cheap AAA Gucci Handbags in www.ecyaya.com(free shipping)

wholesale cheap AAA Bally Purse in www.ecyaya.com

wholesale cheap AAA Coach Handbags in www.ecyaya.com(free shipping)

wholesale cheap AAA Hermes Purse in www.ecyaya.com

wholesale cheap AAA Boss Handbags in www.ecyaya.com(free shipping)

wholesale cheap AAA Coach Purse in www.ecyaya.com

wholesale cheap AAA JIMMY CHOO Handbags in www.ecyaya.com

wholesale cheap AAA Chanel Handbags in www.ecyaya.com(free shipping)

wholesale cheap AAA D&G Purse in www.ecyaya.com

wholesale cheap AAA JIMMY CHOO Purse in www.ecyaya.com(free shipping)


==============================================================================
TOPIC: I'm a newbie. Is this code ugly?
http://groups.google.com/group/comp.lang.c++/t/f085e44989fab5ef?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 24 2010 12:43 pm
From: "io_x"

"LR" <lruss@superlink.net> ha scritto nel messaggio
news:4b5b359f$0$4831$cc2e38e6@news.uslec.net...
>me
> However, I think, since you are interested in finding out if the code
> was ugly, you may want to, for starters, ask if the way the code is
> written aids clarity or hinders it.

it hide nothing

> I am otherwise at a loss as to why the question in the subject was asked
> to begin with. Particularly since you imply that you are not one of the
> people who wants to follow good rules.

i'm no the one that ask that question (if i remember all posts)

> Doesn't this suggest that the
> answer to your question obvious?
> And why would you ask here?

i say: i'm not the one to ask at first post in this thread:
"I'm a newbie. Is this code ugly?"

because i just know what 80% think about it (it is ugly);
and prefer to be silent. it is enought it is not ugly for me

in the end of the game i not think that the OP code is so ugly
because sort array of pointers

> There are people who are interested in not following good rules and in
> particular avoiding clarity. You may find much of value to you here
> http://en.wikipedia.org/wiki/Obfuscated_code
>
> LR


==============================================================================

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: