http://groups.google.com/group/comp.lang.c++?hl=en
comp.lang.c++@googlegroups.com
Today's topics:
* different ways of allocating memory - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/cae68a10a2667fb5?hl=en
* comparing numeric literals - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/6718a9cd2f3ecdbf?hl=en
* Writing good articles that have much better chance to be seen by others - 5
messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/ddbe20a354342370?hl=en
* C++ call C# .NET api (dll) - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/b42e544e36439542?hl=en
* Speed of C++ compared with speed of other languages (was: Exception
Misconceptions: Exceptions are for unrecoverable errors.) - 2 messages, 1
author
http://groups.google.com/group/comp.lang.c++/t/786cfdf0ab25866d?hl=en
* Portability and marshalling integral data - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/d7831b8e84cbb8c3?hl=en
==============================================================================
TOPIC: different ways of allocating memory
http://groups.google.com/group/comp.lang.c++/t/cae68a10a2667fb5?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Dec 24 2009 3:43 pm
From: "Larry"
"Larry" <dontmewithme@got.it> ha scritto nel messaggio
news:4b32b597$0$1112$4fafbaef@reader2.news.tin.it...
>
> "Maxim Yegorushkin" <maxim.yegorushkin@gmail.com> ha scritto nel messaggio
> news:4b32b260$0$9753$6e1ede2f@read.cnntp.org...
>
typedef struct {
char* titolo;
char* autore;
int annopub;
} LIBRO;
// main
const int nbuff = 5;
LIBRO *l = new LIBRO[nbuff];
l[0].annopub = 2009;
l[0].titolo = "...some chars...";
cout << l[0].titolo << " " << l[0].annopub << endl;
delete[] l;
Why if I just use:
LIBRO *l = new LIBRO;
I can access the structure with the -> operator while with LIBRO[nbuff] I
can only use the dot operator? is there much difference?
thanks
==============================================================================
TOPIC: comparing numeric literals
http://groups.google.com/group/comp.lang.c++/t/6718a9cd2f3ecdbf?hl=en
==============================================================================
== 1 of 2 ==
Date: Thurs, Dec 24 2009 3:49 pm
From: "Balog Pal"
"Stefan Ram" <ram@zedat.fu-berlin.de>
>>So your original problem around the "how you explain" is still as moot as
>>originally, care to elaborate?
>
> My original assumption was that one can not easily restrict
> the set of integer types to »int«.
Indeed, the language was not built to be tuned that way ;-))). Guess we
could build a similar statement, how hard it is to restrict to not using the
String type.
> A student might observe,
> for example, that under his C++ implementation,
> »-1 < 3000000000« yields 0 and ask for an explanation.
And you explain him that his implementation is poor QoI-wise, as I see no
excuse to not issue a diagnostic for the case. You can explain that C++ as
C has a plenty of areas with Undefined behavior and using numbers beyond the
legal range is one of them.
> To correctly explain this, one might need to mention »long«
You may or may not mention long. Note that the expression was either an
error itself (too many zeroes) then has little to do with long just must be
corrected. Or you want to use 3G, and then your idea with ints is just bad.
> and possibly also »unsigned long« (in the case of this C++
> implementation).
LOL. Yes, the norm is that C++ has a number of integral types with
different range, and programmers use them to handle information in the
fitting range.
*If* your program does not ever need to leave the range 'int' has, you can
arrange for your arbitrary restriction.
Honestly I can hardly imagine a good field for that -- if you go without an
OS, you likely need low level things and use all the types; and if you have
API for an OS, then you must play along.
== 2 of 2 ==
Date: Thurs, Dec 24 2009 3:54 pm
From: "Balog Pal"
> Guys, I think you should immediately read this:
>
> http://www.stsc.hill.af.mil/CrossTalk/2008/01/0801DewarSchonberg.html
http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html
==============================================================================
TOPIC: Writing good articles that have much better chance to be seen by others
http://groups.google.com/group/comp.lang.c++/t/ddbe20a354342370?hl=en
==============================================================================
== 1 of 5 ==
Date: Thurs, Dec 24 2009 3:51 pm
From: Krice
On 24 joulu, 22:05, ta...@mongo.net (tanix) wrote:
> If you think YOUR ego is the most important thing in the
> world, think again.
Yes please, think it again.
== 2 of 5 ==
Date: Thurs, Dec 24 2009 6:31 pm
From: tanix@mongo.net (tanix)
In article <466f391e-0518-49c4-95d0-a210f6626e23@26g2000yqo.googlegroups.com>, Krice <paulkp@mbnet.fi> wrote:
>On 24 joulu, 22:05, ta...@mongo.net (tanix) wrote:
>> If you think YOUR ego is the most important thing in the
>> world, think again.
>
>Yes please, think it again.
Yep, that is exactly what I mean.
:--}
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 3 of 5 ==
Date: Thurs, Dec 24 2009 6:56 pm
From: red floyd
On 12/24/2009 12:05 PM, tanix wrote:
> [redacted]
Here's another one.
Avoid ad-hominem attacks against people who have professional
reputations you could only dream about having. People such as
Pete Becker.
== 4 of 5 ==
Date: Thurs, Dec 24 2009 7:05 pm
From: tanix@mongo.net (tanix)
In article <hh19ki$6e9$1@news.eternal-september.org>, red floyd <no.spam.here@its.invalid> wrote:
>On 12/24/2009 12:05 PM, tanix wrote:
>> [redacted]
>
>Here's another one.
>
>Avoid ad-hominem attacks against people who have professional
>reputations you could only dream about having.
Yep. Exactly what I mean.
:--}
Except you'd have to clarify what that "professional reputation"
means, and how would you know?
>People such as Pete Becker.
He may be god to you indeed and you can pray on your knees
if you wish.
But this thread is not about slugging out at who can jump higher
than his own weanie. Makes sense?
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 5 of 5 ==
Date: Thurs, Dec 24 2009 7:15 pm
From: tanix@mongo.net (tanix)
In article <hh1a5o$qg4$2@news.eternal-september.org>, tanix@mongo.net (tanix) wrote:
>In article <hh19ki$6e9$1@news.eternal-september.org>, red floyd
> <no.spam.here@its.invalid> wrote:
>>On 12/24/2009 12:05 PM, tanix wrote:
>>> [redacted]
>>
>>Here's another one.
>>
>>Avoid ad-hominem attacks against people who have professional
>>reputations you could only dream about having.
>
>Yep. Exactly what I mean.
>:--}
>
>Except you'd have to clarify what that "professional reputation"
>means, and how would you know?
>
>>People such as Pete Becker.
>
>He may be god to you indeed and you can pray on your knees
>if you wish.
>
>But this thread is not about slugging out at who can jump higher
>than his own weanie. Makes sense?
Btw. Do you know what kind of people change the subject line
as you, fools, do?
They are called sickos. Jealous intolerand idiots,
who have nothing better to do in ther lives then pervert things.
Makes sense?
:--}
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
==============================================================================
TOPIC: C++ call C# .NET api (dll)
http://groups.google.com/group/comp.lang.c++/t/b42e544e36439542?hl=en
==============================================================================
== 1 of 2 ==
Date: Thurs, Dec 24 2009 5:41 pm
From: yqever
Slickuser <slick.users@gmail.com> wrote in news:67bcda21-99f8-45a5-80c9-
17982556207a@d9g2000prh.googlegroups.com:
> Hi,
>
> I have two projects, one wrote in C++ and one in C# .NET 3.5 Framework
> sp1.
>
> I would like the C++ project to call C# project dll. How can I expose
> api/function from C# to allow C++ to call. Mostly I will not have the
> source code to C# project, just api I can call.
>
> Example of C# file below so I can get something going. Any help?
>
>
> Test.cs
> using System;
> using System.Collections.Generic;
> using System.Text;
>
> namespace ProjectX
> {
> public class Test
> {
>
> public static void Main()
> {
> Console.WriteLine("Main!");
> }
>
> public void TestCount()
> {
> Console.WriteLine("Count!");
> }
>
> }
> }
two ways:
1. Write your C# dll as COM.
2. Use managed C++.
If you don't have C# code, just use managed C++ to call it.
== 2 of 2 ==
Date: Thurs, Dec 24 2009 6:10 pm
From: Slickuser
Is there any example? Guess google will do.
On Dec 24, 5:41 pm, yqever <yqe...@163.com> wrote:
> Slickuser<slick.us...@gmail.com> wrote in news:67bcda21-99f8-45a5-80c9-
> 179825562...@d9g2000prh.googlegroups.com:
>
>
>
> > Hi,
>
> > I have two projects, one wrote in C++ and one in C# .NET 3.5 Framework
> > sp1.
>
> > I would like the C++ project to call C# project dll. How can I expose
> > api/function from C# to allow C++ to call. Mostly I will not have the
> > source code to C# project, just api I can call.
>
> > Example of C# file below so I can get something going. Any help?
>
> > Test.cs
> > using System;
> > using System.Collections.Generic;
> > using System.Text;
>
> > namespace ProjectX
> > {
> > public class Test
> > {
>
> > public static void Main()
> > {
> > Console.WriteLine("Main!");
> > }
>
> > public void TestCount()
> > {
> > Console.WriteLine("Count!");
> > }
>
> > }
> > }
>
> two ways:
>
> 1. Write your C# dll as COM.
>
> 2. Use managed C++.
>
> If you don't have C# code, just use managed C++ to call it.
==============================================================================
TOPIC: Speed of C++ compared with speed of other languages (was: Exception
Misconceptions: Exceptions are for unrecoverable errors.)
http://groups.google.com/group/comp.lang.c++/t/786cfdf0ab25866d?hl=en
==============================================================================
== 1 of 2 ==
Date: Thurs, Dec 24 2009 6:41 pm
From: Isaac Gouy
On Dec 24, 5:23 am, r...@zedat.fu-berlin.de (Stefan Ram) wrote:
-snip-
> Java 1.6 (aka »Java 6«) is already one of the fastest languages:
>
> http://shootout.alioth.debian.org/gp4/benchmark.php?test=all〈=all
Those are not up-to-date measurements.
These are up-to-date measurements -
http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php
http://shootout.alioth.debian.org/u32q/which-programming-languages-are-fastest.php
http://shootout.alioth.debian.org/u64/which-programming-languages-are-fastest.php
http://shootout.alioth.debian.org/u64q/which-programming-languages-are-fastest.php
http://shootout.alioth.debian.org/which-programming-language-is-fastest.php
== 2 of 2 ==
Date: Thurs, Dec 24 2009 6:43 pm
From: Isaac Gouy
On Dec 24, 11:37 am, Branimir Maksimovic <bm...@hotmail.com> wrote:
-snip-
> >> Java 1.6 (aka »Java 6«) is already one of the fastest languages:
>
> >>http://shootout.alioth.debian.org/gp4/benchmark.php?test=all〈=all
>
> > Yep, that is what I suspected.
>
> Yeah, that site is really good reference for language benchmarks ;)
> Why don;t they test application with more then 100 lines of code ;)
It's too difficult to get anyone to read programs that are shorter
than 100 lines of code.
==============================================================================
TOPIC: Portability and marshalling integral data
http://groups.google.com/group/comp.lang.c++/t/d7831b8e84cbb8c3?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Dec 24 2009 11:32 pm
From: Brian
On Nov 25, 4:10 am, James Kanze <james.ka...@gmail.com> wrote:
> On Nov 24, 10:41 pm, Brian <c...@mailvault.com> wrote:
>
>
>
>
>
> > On Nov 24, 4:30 pm, Paavo Helde <myfirstn...@osa.pri.ee> wrote:
> > > Brian <c...@mailvault.com> wrote in news:2ff925d9-9d6f-4285-b0d2-
> > > 8175bb0a0...@u20g2000vbq.googlegroups.com:
> > > > I'm wondering if it is possible to set things up so that
> > > > the more portable functions are used in a more limited way
> > > > than what I've seen suggested here. For example if a
> > > > server has both big endian and little endian (Intel)
> > > > clients, would it work to have the server send a "big
> > > > endian" stream to the big endian clients and a "little
> > > > endian" stream to Intel clients -- then both of those
> > > > types of clients could use memcpy to read/demarshall
> > > > integral data types?
> > > Are you seriously claiming that a data stream can be pumped
> > > over the network faster than the client can do some
> > > bitshifting?
> > No, I'm saying it seems like there's a way to eliminate the
> > need for bit shifting when reading data. It isn't clear to me
> > what (portability) is lost by doing it that way.
>
> It's possible for the server to systematically send and receive
> data in the internal format of the client, yes. Provided it
> knows this format (the client tells it). Does it buy you
> anything? I'm not really sure.
>
> The issue is particularly important with regards to floating
> point; if the protocol specifies a format with a fixed maximum
> precision (e.g.IEEEdouble), and the machines at both ends
> both support higher precision, then information is lost
> unnecessarily.
>
> In this regard, you might be interested in theBERencoding of
> RealType. In the case ofBER, the goal is to not loose
> precision unless necessary, so the rule is always to use the
> sender's format, with the receiver interpreting it.
In retrospect, I wish I had done things this way. Instead I
made senders format for byte order. I'm in the process
now of changing it to "always use the sender's format."
A week or so ago I made my Buffer class a class template
parameterized on the byte order.
http://webEbenezer.net/misc/Buffer.hh
http://webEbenezer.net/misc/Formatting.hh
I've also added a tar file now that has these files
http://webEbenezer.net/misc/direct.tar.bz2
Anyway, I thought everything was going fine with that.
For example, http://webEbenezer.net/misc/File.hh, shows
how using function templates handle things nicely for a
stream constructor and a Send function. But then I
remembered that the Send functions can be virtual.
Since C++ doesn't currently support mixing function
templates and virtual functions, I was forced to
change my approach.
Thankfully, there seems to be a way to avoid resorting
to class templates (for all of the classes involved in
marshalling) which permit the use of virtual functions.
I'm thinking about splitting up the Buffer class into
two classes: SendBuffer and ReceiveBuffer. (The names
may change.) SendBuffer would be a plain class and
ReceiveBuffer would be a class template parameterized on
the byte order. The stream constructors would be
function templates still, but the Send functions wouldn't
be and they could still be virtual. I've liked having one
Buffer class that was used for both sending and receiving,
but I really dislike the idea of requiring all user
classes (that are marshalled) to be class templates.
This seems like a reasonable way to deal with the
various factors. I'm curious whether others have one or
two classes involved in buffering. So now I'm hoping to
not do any formatting when sending data and leave that
up to the receiving code.
I spent quite a bit of time working things out the
other way, so it is taking me a while to rework
things. I don't think of it as totally wasted time,
since the two implementations are similar. Perhaps
though I should have caught this earlier and avoided
the need to rework things. So often I'm reminded of
the saying, "Better late than never."
Brian Wood
http://webEbenezer.net
==============================================================================
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