Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #32831
| From | Richard Heathfield <invalid@see.sig.invalid> |
|---|---|
| Organization | Go, ion artisan! |
| Subject | Re: Why compiler is able to vectorize on int but not on unsigned |
| Newsgroups | comp.lang.c++, comp.lang.c |
| References | <20141203111909.5ec8c7fc@maxa-pc> <m5n1l8$m45$1@dont-email.me> <m5n4rq$k42$1@speranza.aioe.org> <m5n6dk$8d0$1@dont-email.me> |
| Followup-To | Choose, an, appropriate, group, to, redirect, replies... |
| Message-ID | <eeFfw.45208$Ox2.3714@fx46.am4> (permalink) |
| Date | 2014-12-03 14:36 +0000 |
Cross-posted to 2 groups.
Followups directed to: Choose, an, appropriate, group, to, redirect, replies...
Victor Bazarov wrote:
> On 12/3/2014 8:57 AM, jacob navia wrote:
>> Le 03/12/2014 14:02, James Kuyper a écrit :
>>> On 12/03/2014 05:19 AM, Melzzzzz wrote:
>>> ...
>>>> int testNormal(const vector_t & ghs, const vector_t & lhs) {
>>> ...
>>>> where: typedef vector<int> vector_t;
>>>
>>> Cross-posting to comp.lang.c a question about code that can't even be
>>> compiled as C code is pointless.
>>>
>>
>> He wrote (and you did not quote that)
>>
>> > (could be also plain array so I post this to clc as well)
>>
>> Read for comprehension next time.
>
> The code uses references and a member function. Do those exist in C?
No, but plain arrays do.
> (it's been some time since I touched C)
It's good for you. Stops you getting scurvy or rickets or something like
that.
> And if vector_t is a "plain
> array", how can it have a member ('size') at all?
In a sense, of course, it can't. Nevertheless, a number of trivial solutions
to the problem do exist. You can use an extra parameter to allow the size to
be passed in, or you can make vector_t a structure type which contains not
only the array but also the size. (If it's dynamic, you keep a count. If
it's static, you can just sizeof arr / sizeof arr[0], provided it's safely
tucked up inside the struct.)
--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-03 11:19 +0100
Re: Why compiler is able to vectorize on int but not on unsigned James Kuyper <jameskuyper@verizon.net> - 2014-12-03 08:02 -0500
Re: Why compiler is able to vectorize on int but not on unsigned jacob navia <jacob@spamsink.net> - 2014-12-03 14:57 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Tim Prince <tprince@computer.org> - 2014-12-03 09:23 -0500
Re: Why compiler is able to vectorize on int but not on unsigned James Kuyper <jameskuyper@verizon.net> - 2014-12-03 10:03 -0500
Re: Why compiler is able to vectorize on int but not on unsigned Victor Bazarov <v.bazarov@comcast.invalid> - 2014-12-03 09:24 -0500
Re: Why compiler is able to vectorize on int but not on unsigned Richard Heathfield <invalid@see.sig.invalid> - 2014-12-03 14:36 +0000
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-03 16:03 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Victor Bazarov <v.bazarov@comcast.invalid> - 2014-12-03 10:27 -0500
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-03 16:43 +0100
Re: Why compiler is able to vectorize on int but not on unsigned red floyd <no.spam@its.invalid> - 2014-12-03 08:59 -0800
Re: Why compiler is able to vectorize on int but not on unsigned Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-12-03 18:53 +0100
Re: Why compiler is able to vectorize on int but not on unsigned James Kuyper <jameskuyper@verizon.net> - 2014-12-03 13:13 -0500
Re: Why compiler is able to vectorize on int but not on unsigned Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-12-04 22:04 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-05 10:07 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-12-05 10:42 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-05 11:29 +0100
csiph-web