🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: csu.cs.200
Article #199

Re: Help with aCC compiling errors

#199
From: ken shrum
Date: Tue, 06 Oct 1998 00:00
54 lines
2514 bytes
spasm (spasm@holly.colostate.edu) wrote:
: Using the old CC command to compile my assignment #3 program, I recieved
: no errors and achieved the desired output. Using the new aCC command to
: compile my program, I get the following errors:

On an HP machine, CC should only be used for backward compatibility
for legacy applications.  This is not what you folks are doing.  I
encourage you to only use aCC, unless you have specific instructions
otherwise.

aCC more closely tracks the ISO standard for C++, although it is not
yet conformant.

: 1. Error (future) 355: "Main3.C", line 46 # Function 'main' must return
: type 'int'.
:     void main()
:          ^^^^

In Standard C++, there are two legal signatures for main:
   int main()
   int main(int argc, char** argv)

However, your main function does not have to actually return a value
(for backward compatibility with older C++ apps).  Falling out of main
without a return is the same as returning zero.

: 2. Error 409: "Main3.C", line 128 # Cannot convert a non-lvalue to a
: pointer.

: if(strcmp((LIST_Get(list,j)).name,(LIST_Get(list,index)).name) >
: 0)                        ^^^^^^^^^^^^^^^^^^^^^^

: 3. Error 409: "Main3.C", line 128 # Cannot convert a non-lvalue to a
: pointer.

: if(strcmp((LIST_Get(list,j)).name,(LIST_Get(list,index)).name) >
: 0)
: ^^^^^^^^^^^^^^^^^^^^^^^^^^

These are the same error, dressed differently.  I'd have to see the
spec for LIST_Get, but it appears to be returning a struct/class type
by value, where the name field is of type char*.  (This is just my
guess from the code shown)

An un-named temporary, which includes things returned by value from
functions, is not an lvalue.  An lvalue is something that can appear
on the left hand side of an assignment operator, a "left value." 
Variables are lvalues, for example.  Taking the address of a temporary
is bad, since the temporary won't outlive the expression.

Again, this is just my best guess.  Without more context, it's hard
to tell.

    Ken Shrum
Technical Details
Message-ID: <6vd7d9$7m4@alain.cs.colostate.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3612620F.C024CCAE@holly.colostate.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 127144,ebc15a71af1aa21f
X-Google-Attributes: gid127144,public
From: shrum@alain.cs.colostate.edu (ken shrum)
Subject: Re: Help with aCC compiling errors
Date: 1998/10/06
Message-ID: <6vd7d9$7m4@alain.cs.colostate.edu>
X-Deja-AN: 398268947
References: <3612620F.C024CCAE@holly.colostate.edu>
Organization: Computer Science Department, Colorado State University
Newsgroups: csu.cs.200