Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: why cant fu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 65 of 157 Topic 25604 of 27343
Post > Topic >>

Re: why cant functions return arrays

by jacob navia <jacob@[EMAIL PROTECTED] > Apr 21, 2008 at 05:21 PM

Ben Bacarisse wrote:
> jacob navia <jacob@[EMAIL PROTECTED]
> writes:
> 
>> Keith Thompson wrote:
>> [snip]
>>
>>> What could be done, I suppose, is to add an entirely new array-like
>>> construct to C, one that doesn't depend on pointer semantics for its
>>> fundamental operations or decay to a pointer in most contexts.  Let's
>>> call it a "vector".  
>> Correct. This is the way that lcc-win has choosen. Using
>> operator overloading of the '[' and ']' operators lcc-win
>> offers a true array type that doesn't "decay" to anything.
> 
> Way off-topic now so I've set followup-to comp.compilers.lcc, but I
> can't see how that can do anything.  In this code:
> 
>   int a[10];
>   f(a);
> 
> there are no [] operators, so how does the compiler know which sort of
> array I want?
> 

Because you tell it to:

int a[10]; // Normal C array
Vector v = newVector(10,sizeof(int));

a[2] = 5;
v[2] = 5;

> <snip>
>> ... Operator overloading provides a simple and elegant solution as
>> I have been claiming since several years now.
> 
> I think treating initialisation as assignment and, if I recall
> correctly, *not* treating argument passing as assignment makes your
> operator overloading much less useful than it might have been.
> 

All argument passing are assignments in standard C.

But if you want C++, no, it is not C++.

-- 
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 




 157 Posts in Topic:
why cant functions return arrays
"sanjay.vasudevan@[E  2008-04-14 14:25:11 
Re: why cant functions return arrays
roberson@[EMAIL PROTECTED  2008-04-14 21:41:05 
Re: why cant functions return arrays
jacob navia <jacob@[EM  2008-04-14 23:54:54 
Re: why cant functions return arrays
"Bartc" <bc@  2008-04-14 21:57:20 
Re: why cant functions return arrays
jacob navia <jacob@[EM  2008-04-14 23:59:17 
Re: why cant functions return arrays
richard@[EMAIL PROTECTED]  2008-04-14 22:56:12 
Re: why cant functions return arrays
"Default User"   2008-04-14 23:19:54 
Re: why cant functions return arrays
Eric Sosman <esosman@[  2008-04-15 08:44:29 
Re: why cant functions return arrays
"Dik T. Winter"  2008-04-15 01:15:20 
Re: why cant functions return arrays
"Dik T. Winter"  2008-04-15 01:12:54 
Re: why cant functions return arrays
Jack Klein <jackklein@  2008-04-14 21:59:34 
Re: why cant functions return arrays
jacob navia <jacob@[EM  2008-04-14 23:55:21 
Re: why cant functions return arrays
Jack Klein <jackklein@  2008-04-14 22:01:40 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-18 00:09:20 
Re: why cant functions return arrays
user923005 <dcorbit@[E  2008-04-14 15:36:58 
Re: why cant functions return arrays
Ben Bacarisse <ben.use  2008-04-14 23:43:58 
Re: why cant functions return arrays
Hallvard B Furuseth <h  2008-04-15 01:00:20 
Re: why cant functions return arrays
"Bartc" <bc@  2008-04-14 23:55:07 
Re: why cant functions return arrays
Hallvard B Furuseth <h  2008-04-15 15:36:25 
Re: why cant functions return arrays
jacob navia <jacob@[EM  2008-04-15 16:25:56 
Re: why cant functions return arrays
"Bartc" <bc@  2008-04-15 17:42:24 
Re: why cant functions return arrays
Hallvard B Furuseth <h  2008-04-16 17:07:25 
Re: why cant functions return arrays
Shirsoft <shirsoft@[EM  2008-04-15 00:39:07 
Re: why cant functions return arrays
"Bartc" <bc@  2008-04-17 09:23:14 
Re: why cant functions return arrays
John Bode <john_bode@[  2008-04-15 12:25:29 
Re: why cant functions return arrays
jacob navia <jacob@[EM  2008-04-15 22:56:36 
Re: why cant functions return arrays
Eric Sosman <esosman@[  2008-04-15 21:25:36 
Re: why cant functions return arrays
"Dik T. Winter"  2008-04-16 10:42:53 
Re: why cant functions return arrays
Jack Klein <jackklein@  2008-04-15 20:53:13 
Re: why cant functions return arrays
CBFalconer <cbfalconer  2008-04-16 01:09:23 
Re: why cant functions return arrays
Keith Thompson <kst@[E  2008-04-15 13:07:04 
Re: why cant functions return arrays
Shirsoft <shirsoft@[EM  2008-04-16 04:49:02 
Re: why cant functions return arrays
CBFalconer <cbfalconer  2008-04-16 09:00:08 
Re: why cant functions return arrays
"Bartc" <bc@  2008-04-16 22:56:57 
Re: why cant functions return arrays
"Default User"   2008-04-16 23:05:17 
Re: why cant functions return arrays
"Bartc" <bc@  2008-04-17 00:12:45 
Re: why cant functions return arrays
"Default User"   2008-04-17 16:18:15 
Re: why cant functions return arrays
Antoninus Twink <nospa  2008-04-16 22:00:19 
Re: why cant functions return arrays
Richard <devr_@[EMAIL   2008-04-17 18:26:04 
Re: why cant functions return arrays
"sanjay.vasudevan@[E  2008-04-18 12:15:36 
Re: why cant functions return arrays
"sanjay.vasudevan@[E  2008-04-18 12:25:20 
Re: why cant functions return arrays
Keith Thompson <kst-u@  2008-04-19 20:32:07 
Re: why cant functions return arrays
James Dow Allen <jdall  2008-04-20 04:37:22 
Re: why cant functions return arrays
jacob navia <jacob@[EM  2008-04-20 14:23:30 
Re: why cant functions return arrays
Chris Torek <nospam@[E  2008-04-20 23:45:38 
Re: why cant functions return arrays
Richard <devr_@[EMAIL   2008-04-20 13:42:00 
Re: why cant functions return arrays
Richard <devr_@[EMAIL   2008-04-20 13:44:09 
Re: why cant functions return arrays
cri@[EMAIL PROTECTED] (R  2008-04-20 16:58:08 
Re: why cant functions return arrays
Richard Heathfield <rj  2008-04-20 17:07:58 
Re: why cant functions return arrays
gazelle@[EMAIL PROTECTED]  2008-04-20 17:35:07 
Re: why cant functions return arrays
Keith Thompson <kst-u@  2008-04-20 15:07:56 
Re: why cant functions return arrays
"Default User"   2008-04-21 00:49:39 
Re: why cant functions return arrays
CBFalconer <cbfalconer  2008-04-20 18:39:27 
Re: why cant functions return arrays
Richard <devr_@[EMAIL   2008-04-20 19:46:27 
Re: why cant functions return arrays
soscpd <soscpd@[EMAIL   2008-04-20 13:28:20 
Re: why cant functions return arrays
CBFalconer <cbfalconer  2008-04-20 18:43:28 
Re: why cant functions return arrays
"Bartc" <bc@  2008-04-20 23:53:55 
Re: why cant functions return arrays
Richard <devr_@[EMAIL   2008-04-21 02:51:43 
Re: why cant functions return arrays
Richard <devr_@[EMAIL   2008-04-21 03:01:04 
Re: why cant functions return arrays
soscpd <soscpd@[EMAIL   2008-04-20 18:02:38 
Re: why cant functions return arrays
Keith Thompson <kst-u@  2008-04-20 23:25:48 
Re: why cant functions return arrays
jacob navia <jacob@[EM  2008-04-21 10:36:08 
Re: why cant functions return arrays
Nick Keighley <nick_ke  2008-04-21 01:08:37 
Re: why cant functions return arrays
Ben Bacarisse <ben.use  2008-04-21 15:21:58 
Re: why cant functions return arrays
jacob navia <jacob@[EM  2008-04-21 17:21:05 
Re: why cant functions return arrays
Ben Bacarisse <ben.use  2008-04-21 18:09:56 
Wit-to-whine ratios
James Dow Allen <jdall  2008-04-24 02:15:53 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-04-24 10:14:36 
Re: Wit-to-whine ratios
jacob navia <jacob@[EM  2008-04-24 12:36:15 
Re: Wit-to-whine ratios
pete <pfiland@[EMAIL P  2008-05-08 04:57:34 
Re: Wit-to-whine ratios
pete <pfiland@[EMAIL P  2008-05-08 05:18:48 
Re: Wit-to-whine ratios
gazelle@[EMAIL PROTECTED]  2008-05-08 12:34:27 
Re: why cant functions return arrays
John Bode <john_bode@[  2008-04-24 08:13:31 
Re: Wit-to-whine ratios
Antoninus Twink <nospa  2008-04-24 20:44:43 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-08 00:39:32 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-08 00:47:55 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-08 00:51:05 
Re: Wit-to-whine ratios
Flash Gordon <spam@[EM  2008-05-08 19:03:52 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-08 20:03:38 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-08 00:58:09 
Re: why cant functions return arrays
spinoza1111 <spinoza11  2008-05-08 04:12:50 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-08 05:50:08 
Re: Wit-to-whine ratios
Mike <m.fee@[EMAIL PRO  2008-05-12 14:00:37 
Re: Wit-to-whine ratios
CBFalconer <cbfalconer  2008-05-08 17:48:12 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-08 22:46:48 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-09 06:07:25 
Re: Wit-to-whine ratios
jacob navia <jacob@[EM  2008-05-09 09:21:55 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-09 07:50:04 
Re: Wit-to-whine ratios
jacob navia <jacob@[EM  2008-05-09 09:58:12 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-09 08:32:08 
Re: Wit-to-whine ratios
Mark McIntyre <markmci  2008-05-10 00:39:54 
Re: Wit-to-whine ratios
CBFalconer <cbfalconer  2008-05-09 23:58:02 
Re: Wit-to-whine ratios
Mark McIntyre <markmci  2008-05-10 12:06:49 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-10 04:38:49 
Re: Wit-to-whine ratios
Flash Gordon <spam@[EM  2008-05-09 18:53:39 
Re: Wit-to-whine ratios
Flash Gordon <spam@[EM  2008-05-09 18:55:58 
Re: Wit-to-whine ratios
Mark McIntyre <markmci  2008-05-10 00:48:00 
Re: Wit-to-whine ratios
Chris McDonald <chris@  2008-05-10 00:14:11 
Re: Wit-to-whine ratios
CBFalconer <cbfalconer  2008-05-10 00:01:28 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-09 18:32:09 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-10 05:03:31 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-10 10:17:24 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-10 18:12:25 
Re: Wit-to-whine ratios
Walter Banks <walter@[  2008-05-10 14:55:53 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-10 12:09:50 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-10 21:08:47 
[very OT] meds
"Malcolm McLean"  2008-05-11 21:09:26 
Re: Wit-to-whine ratios
Nick Keighley <nick_ke  2008-05-10 15:16:08 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-10 22:35:29 
Re: Wit-to-whine ratios
Richard Heathfield <rj  2008-05-11 06:57:45 
Re: Wit-to-whine ratios
pete <pfiland@[EMAIL P  2008-05-11 06:37:23 
Re: Wit-to-whine ratios
pete <pfiland@[EMAIL P  2008-05-11 08:59:08 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-10 22:38:40 
Re: Wit-to-whine ratios
James Dow Allen <jdall  2008-05-11 03:06:34 
Re: Wit-to-whine ratios
James Dow Allen <jdall  2008-05-11 03:15:58 
Re: Wit-to-whine ratios
"Default User"   2008-05-11 20:10:58 
Re: Wit-to-whine ratios
richard@[EMAIL PROTECTED]  2008-05-11 22:46:49 
Re: Wit-to-whine ratios
CBFalconer <cbfalconer  2008-05-11 07:14:49 
Re: why cant functions return arrays
spinoza1111 <spinoza11  2008-05-11 13:14:14 
Re: why cant functions return arrays
Mark McIntyre <markmci  2008-05-11 23:41:36 
Re: why cant functions return arrays
spinoza1111 <spinoza11  2008-05-11 13:18:17 
Re: why cant functions return arrays
spinoza1111 <spinoza11  2008-05-11 13:22:42 
Re: why cant functions return arrays
spinoza1111 <spinoza11  2008-05-11 13:23:53 
Re: Wit-to-whine ratios
Eligiusz Narutowicz<el  2008-05-11 22:29:00 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-11 13:40:10 
Re: Wit-to-whine ratios
Mike <m.fee@[EMAIL PRO  2008-05-12 14:21:48 
Re: Wit-to-whine ratios
pete <pfiland@[EMAIL P  2008-05-12 08:04:49 
Re: Wit-to-whine ratios
santosh <santosh.k83@[  2008-05-12 19:08:19 
Re: Wit-to-whine ratios
Colonel Sanders <colon  2008-05-13 12:54:45 
Re: why cant functions return arrays
spinoza1111 <spinoza11  2008-05-11 13:41:03 
Re: meds
spinoza1111 <spinoza11  2008-05-11 13:48:30 
Re: meds
Richard Heathfield <rj  2008-05-12 01:00:36 
Re: meds
"rio" <a@[EM  2008-05-12 11:34:34 
Re: meds
santosh <santosh.k83@[  2008-05-12 16:43:36 
Re: meds
Richard Heathfield <rj  2008-05-12 11:28:28 
[ot] s C otch
pete <pfiland@[EMAIL P  2008-05-12 07:44:15 
Re: meds
"rio" <a@[EM  2008-05-12 17:52:35 
Re: meds
santosh <santosh.k83@[  2008-05-12 21:40:36 
Re: Wit-to-whine ratios
Chad <cdalten@[EMAIL P  2008-05-11 20:40:21 
apologies to clc [Was: Wit-to-whine ratios]
Nick Keighley <nick_ke  2008-05-12 01:45:39 
Re: meds
spinoza1111 <spinoza11  2008-05-12 04:40:54 
Re: meds
Nick Keighley <nick_ke  2008-05-12 04:44:08 
Re: meds
Eligiusz Narutowicz<el  2008-05-12 13:44:43 
Re: meds
santosh <santosh.k83@[  2008-05-12 19:02:43 
Re: Wit-to-whine ratios
spinoza1111 <spinoza11  2008-05-12 04:56:53 
Re: Wit-to-whine ratios
Mike <m.fee@[EMAIL PRO  2008-05-14 10:12:44 
Re: meds
Eligiusz Narutowicz<el  2008-05-12 15:34:43 
Re: meds
santosh <santosh.k83@[  2008-05-12 19:32:30 
Re: meds
Richard Heathfield <rj  2008-05-12 14:45:30 
Re: meds
santosh <santosh.k83@[  2008-05-12 21:44:15 
Re: meds
Eligiusz Narutowicz<el  2008-05-12 16:19:06 
Re: meds
santosh <santosh.k83@[  2008-05-12 21:42:21 
Re: meds
Sri Harsha Dandibhotla &l  2008-05-12 20:57:21 
Re: meds
Richard Heathfield <rj  2008-05-13 04:05:21 
Re: meds
Sri Harsha Dandibhotla &l  2008-05-12 21:10:31 
Re: meds
Richard Heathfield <rj  2008-05-13 04:36:13 
Re: meds
Eligiusz Narutowicz<el  2008-05-13 16:32:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Sep 6 21:54:30 CDT 2008.