Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Reference to Array bug
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lindsay F. Marshall  
View profile  
 More options Mar 26 1990, 6:06 am
Newsgroups: gnu.g++.bug
From: Lindsay.Marsh...@newcastle.ac.uk (Lindsay F. Marshall)
Date: 26 Mar 90 11:06:39 GMT
Local: Mon, Mar 26 1990 6:06 am
Subject: Reference to Array bug
This code (which passes CC) :-

void example()
{
    char x[80];
    char (&refx)[] = x;

}

causes the following error messages

t.C: In function void example ():
t.C:4: `refx' undeclared (first use this function)
t.C:4: (Each undeclared identifier is reported only once
t.C:4: for each function it appears in.)
t.C:4: parse error before `]'

The whole area of references to arrays seems to have problems.

Lindsay
--
MAIL : Lindsay.Marsh...@newcastle.ac.uk (UUCP: s/\(.*\)/...!ukc!\1/)
POST : Computing Laboratory, The University, Newcastle upon Tyne, UK NE1 7RU
VOICE: +44-91-222-8267          FAX: +44-91-222-8232


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
102SMI  
View profile  
 More options Apr 4 1990, 11:46 pm
Newsgroups: gnu.g++.bug
Followup-To: gnu.g++.bug
From: pez...@cis.udel.edu (102SMI)
Date: 4 Apr 90 21:04:46 GMT
Local: Wed, Apr 4 1990 5:04 pm
Subject: Re: Reference to Array bug
In article <1990Mar26.110639.12...@newcastle.ac.uk> Lindsay.Marsh...@newcastle.ac.uk (Lindsay F. Marshall) writes:

>This code (which passes CC) :-

>void example()
>{
>    char x[80];
>    char (&refx)[] = x;

>}

I came across this with function pointers.  It seems as if g++ gets confused
when it sees the `(' after `char'.

Fix: put the keyword `auto' in front.  eg, `auto char (&refx)[] = x;'

It worked for the function pointer problem and compiled (have tested
execution) for your example.

This only seems to be a problem with local variables.  I've used
function pointers successfully as class members without `auto'.
-Daniel
Daniel Pezely <pez...@udel.edu> (NSFnet)  728 Bent Ln, Newark, DE 19711 | Skate
Comp Sci Lab, Smith Hall, U of Delaware, Newark, DE 19716; 302/451-6339 |  ICE


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ronald Guilmette  
View profile  
 More options Apr 5 1990, 12:26 pm
Newsgroups: gnu.g++.bug
From: r...@ics.uci.edu (Ronald Guilmette)
Date: 5 Apr 90 03:48:22 GMT
Local: Wed, Apr 4 1990 11:48 pm
Subject: Re: Reference to Array bug

The syntax supported by cfront for declaring pointers to functions or
pointers to arrays (or references to functions or references to arrays)
does not work in g++ in two contexts, i.e. local declarations, and
declarations of formal parameters.

In these cases, you must use a typedef or add the word 'auto'.

If you are dealing with formal parameters, you had better use a typedef
if you want your code to be portable to cfront.

// Ron Guilmette (r...@ics.uci.edu)
// C++ Entomologist
// Motto:  If it sticks, force it.  If it breaks, it needed replacing anyway.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »