why array can't be assigned, like structs?
Mar 8 '07
57 3269
On Fri, 09 Mar 2007 17:05:49 -0800, in comp.lang.c , Keith Thompson
<ks***@mib.orgw rote:
>Mark McIntyre <ma**********@s pamcop.netwrite s:
>On Thu, 08 Mar 2007 17:31:40 -0800, in comp.lang.c , Keith Thompson <ks***@mib.org wrote:
Yes, it would have been clearer. It would also have been correct, which your original statement quite simply was not.
My original statement was absolutely correct, An array is a derived
type.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
On Mar 10, 12:05 pm, Mark McIntyre <markmcint...@s pamcop.netwrote :
On 9 Mar 2007 16:03:04 -0800, in comp.lang.c , "Harald van D?k"
<true...@gmail. comwrote:
You claimed that array assignment /has/ to be disallowed, because
arrays are derived types. Yevgen Muntyan's example disproved this.
No I didn't. I said that an array was a derived type, not a simple
type and has different behaviour.
***********>Mar k McIntyre <markmcint...@s pamcop.netwrite s:
On 8 Mar 2007 11:01:30 -0800, in comp.lang.c , buuuu...@gmail. com
wrote:
[un-snip start]
why? what's the reason? why array's cant be like any other type in C?
why it have to be different?
[un-snip end]
>
An array isn't a type. Its a derived type, and has different
behaviour. Similarly structs.
***********
You snipped too much. You claimed that an array isn't a type, and that
that is the reason it has to be different. If others don't read your
reply as an answer to the question (as "Because an array isn't a
type.") though, I'll admit I'm wrong on that part.
(snippage)
I'm curious as to how that answers my question above.
It doesn't, because your question was not relevant,
My point was that derived types have different behaviour to simple
types, and so you cannot assume that simple assignment will be
possible. I gave an example showing how you cannot assign to a struct
using a method that other languages support, and indeed C allows you
to use to /initialise/ a struct (and indeed an array).
And I showed that you /can/ assign to a struct using that same method.
The syntax is different from initialisation, but I also showed that
the syntax for initialising and assigning to basic types
(specifically, int) differs as well, so how did you read that as a
difference between structures and basic types?
Richard Heathfield wrote:
Default User said:
Richard Heathfield wrote:
Default User said:
<http://groups.google.c om/support/bin/topic.py?topic= 9246>
What would Google know about newsgroups?
He's a Google user, he ought to be at least familiar with their help
section.
Yeah. What he might not realise from reading Google's help pages is
that newsgroups are not a Google product, but a well-established
on-line society to which Google has attached itself like a remora.
Did you actually READ the link I provided?
"What is a Usenet Newsgroup?
Usenet is an online bulletin board system that began at Duke University
in 1979. Usenet users can post messages to newsgroups that can be read
(and responded to) by anyone who has access to the system through a
newsreader. Over the years, the number of newsgroups has grown into the
thousands, hosted all over the world and covering every conceivable
topic.
Google Groups contains the world's most comprehensive archive of Usenet
postings, dating back to 1981. Google Groups eliminates the need for a
newsreader and lets you search this archive the same way you'd search
on the web. You can also use Google Groups to post your own comments to
an existing Usenet newsgroup."
Nor will he learn that Google behaves irresponsibly by refusing to
clamp down on Usenet abuse perpetrated via their servers.
That's a different story.
Brian
Mark McIntyre <ma**********@s pamcop.netwrite s:
On Fri, 09 Mar 2007 17:05:49 -0800, in comp.lang.c , Keith Thompson
<ks***@mib.orgw rote:
>>Mark McIntyre <ma**********@s pamcop.netwrite s:
>>On Thu, 08 Mar 2007 17:31:40 -0800, in comp.lang.c , Keith Thompson <ks***@mib.or gwrote:
Yes, it would have been clearer. It would also have been correct, which your original statement quite simply was not.
My original statement was absolutely correct, An array is a derived
type.
That part of your original statement, in the second sentence, was
correct (except for the grammatical error of "its"). The problem
was with the first sentence. Here, let me present it again:
Mark McIntyre <ma**********@s pamcop.netwrite s:
An array isn't a type. Its a derived type, and has different
behaviour. Similarly structs.
--
"The way I see it, an intelligent person who disagrees with me is
probably the most important person I'll interact with on any given
day."
--Billy Chambless
On 10 Mar 2007 08:10:53 -0800, in comp.lang.c , "Harald van D?k"
<tr*****@gmail. comwrote:
>You snipped too much. You claimed that an array isn't a type, and that that is the reason it has to be different.
You apparently mentally snipped too much, for the distinction I was
drawing was between a simple and derived type.
>And I showed that you /can/ assign to a struct using that same method.
So what? As I've said ad nauseam, you can't prove it by example, only
disprove by counterexample.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
On Sat, 10 Mar 2007 09:25:20 -0800, in comp.lang.c , Ben Pfaff
<bl*@cs.stanfor d.eduwrote:
>That part of your original statement, in the second sentence, was correct (except for the grammatical error of "its"). The problem was with the first sentence. Here, let me present it again:
Feel free, I've done so myself elsethread.
>Mark McIntyre <ma**********@s pamcop.netwrite s:
>An array isn't a type. Its a derived type, and has different behaviour. Similarly structs.
Clearly people are harder of reading than I thought. The distinction
I'm making is between a simple and derived type.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Default User said:
Richard Heathfield wrote:
>Default User said:
Richard Heathfield wrote: Default User said:
<http://groups.google.c om/support/bin/topic.py?topic= 9246>
What would Google know about newsgroups?
He's a Google user, he ought to be at least familiar with their
help section.
Yeah. What he might not realise from reading Google's help pages is that newsgroups are not a Google product, but a well-established on-line society to which Google has attached itself like a remora.
Did you actually READ the link I provided?
Yes, actually. Hence "might not" rather than "will not".
<snip>
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at the above domain, - www.
Mark McIntyre said:
On Sat, 10 Mar 2007 09:25:20 -0800, in comp.lang.c , Ben Pfaff
<bl*@cs.stanfor d.eduwrote:
>>That part of your original statement, in the second sentence, was correct (except for the grammatical error of "its"). The problem was with the first sentence. Here, let me present it again:
Feel free, I've done so myself elsethread.
>>Mark McIntyre <ma**********@s pamcop.netwrite s:
>>An array isn't a type. Its a derived type, and has different behaviour. Similarly structs.
Clearly people are harder of reading than I thought. The distinction
I'm making is between a simple and derived type.
Nevertheless, the way in which you drew that distinction is flawed, and
that's all that your correspondents seem to be claiming.
If an array is a derived type, then it is a type, and yet you claimed:
"An array isn't a type." Clearly, you understand that it /is/ in fact a
type, so presumably you will understand and agree that the sentence I
just quoted is incorrect.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at the above domain, - www.
Mark McIntyre <ma**********@s pamcop.netwrite s:
>>Mark McIntyre <ma**********@s pamcop.netwrite s:
>>An array isn't a type. Its a derived type, and has different behaviour. Similarly structs.
Clearly people are harder of reading than I thought. The distinction
I'm making is between a simple and derived type.
OK. In the future please try to make it clear by saying "An
array isn't a simple type" then.
--
"...Almost makes you wonder why Heisenberg didn't include postinc/dec operators
in the uncertainty principle. Which of course makes the above equivalent to
Schrodinger's pointer..."
--Anthony McDonald
Mark McIntyre wrote:
On 10 Mar 2007 08:10:53 -0800, in comp.lang.c , "Harald van D?k"
<tr*****@gmail. comwrote:
>You snipped too much. You claimed that an array isn't a type, and that that is the reason it has to be different.
You apparently mentally snipped too much, for the distinction I was
drawing was between a simple and derived type.
>And I showed that you /can/ assign to a struct using that same method.
So what? As I've said ad nauseam, you can't prove it by example, only
disprove by counterexample.
You mean you can't prove that assignment is possible by providing
an example of assignment; but it's possible to disprove it by providing
piece of code which isn't even C? Interesting. What does "one can
assign structures" in your world? You really need to state what you
are "proving".
Yevgen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian |
last post by:
I'm diddlying with a script, and found some behavior I don't understand.
Take this snippet:
for ($i = 0; $i <= count($m); $i++) {
array_shift($m);
reset($m);
}
|
by: Stormkid |
last post by:
Hi Group I'm trying to figure out a way that I can take two (two
dimensional) arrays and avShed and shed, and subtract the matching elements
in shed from avShed I've pasted the arrays blow from a print_r cmd any
suggestions would be great. Thanks much Todd
//avShed array
Array ( => Array ( => 1 => 08:00 ) => Array
( => 1 => 08:05 ) => Array ( => 1
=> 08:10 ) => Array ( => 1 => 08:15 )
=> Array ( => 1 => 08:20 ) => Array...
|
by: lawrence |
last post by:
I wanted to test xml_parse_into_struct() so I took the example off of
www.php.net and put this code up on a site:
<?php
$simple = <<<END
<item>
|
by: vcardillo |
last post by:
Hello all,
Okay, I am having some troubles. What I am doing here is dealing with
an employee hierarchy that is stored in an array. It looks like this:
$employees = array( "user_id" => array( "name", "title",
"reports to user id", "start date in the format: mm/dd/yyyy" )
);
How can I display this hierarchy in simple nested <li> tags in the most
|
by: Sam Collett |
last post by:
How do I remove an item with a specified value from an array?
i.e. array values 1,2,2,5,7,12,15,21
remove 2 from array would return
1,5,7,12,15,21
(12 and 21 are NOT removed, duplicates are also removed)
So far I have (val is value, ar is array, returns new array):
| |
by: Mike S. Nowostawsky |
last post by:
I tried using the "toUpperCase()" property to change the value of an array
entity to uppercase BUT it tells me that the property is invalid. It seems
that an array is not considered an object when it is assigned a text
literal?? HOW can I change the array value to upper case then? What other
method exists for arrays?
Ex:
var GridArrayName1 = new Array();
GridArrayName1 = new Array ('test-value');
GridArrayName1 = GridArrayName1...
|
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of code...
TCHAR myArray;
DoStuff(myArray);
|
by: Leszek |
last post by:
Hi.
Is it possible in javascript to operate on an array without knowing how mamy
elements it has?
What i want to do is sending an array to a script, and this script should
add all values from that array
Could you show me a little example how to do this?
Thanks.
|
by: Jim Carlock |
last post by:
Looking for suggestions on how to handle bad words that might
get passed in through $_GET variables.
My first thoughts included using str_replace() to strip out such
content, but then one ends up looking for characters that wrap
around the stripped characters and it ends up as a recursive
ordeal that fails to identify a poorly constructed $_GET
variable (when someone hand-types the item into the line and
makes a simple typing error).
|
by: =?Utf-8?B?U2hhcm9u?= |
last post by:
Hi Gurus,
I need to transfer a jagged array of byte by reference to unmanaged
function, The unmanaged code should changed the values of the array, and when
the unmanaged function returns I need to show the array data to the end user.
Can I do that?
How?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |