🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #534

const storage class

#534
From: Behnam Tabatabai
Date: Fri, 02 Oct 1992 12:33
46 lines
1540 bytes
When compiling this code, gcc (2.2.2) produces the following warnings:

gcc -O -c test.c
test.c: In function `main':
test.c:26: warning: passing arg 1 of `foo' from incompatible pointer type

Is this a bug?

/* file test.c */

typedef float mat3[3][3];
void foo( const mat3 a, mat3 b ); /* some matrix manipulation */
void foo( const mat3 a, mat3 b)
{
  int i, j;
  
  for ( i = 0; i < 3; i++ )
    for ( j = 0; j < 3; j++ )
    {
      b[i][j] = -a[i][j];
    }
}

int main()
{
  mat3 a = {
    {1.0, 1.0, 1.0},
    {1.0, 1.0, 1.0},
    {1.0, 1.0, 1.0}
  };
  
  mat3 b;
  
  foo( a, b );
  return 1;
}
/* end of file test.c */

Thanks for any hints.
Behnam
--
Behnam Tabatabai                  | email: tab@piis05.joanneum.ac.at (internet)
                                  |        tab@piis10.joanneum.ac.at (internet)
Institute for Information Systems |        tabatabai@joanneum.ada.at (X.400)
Joanneum Research                 | tel:   (++43/316) 8020 - 241
Graz, Austria                     | fax:   (++43/316) 8020 - 181
Technical Details
Message-ID: <1992Oct2.123309.26547@news.tu-graz.ac.at>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!news.tu-graz.ac.at!piis05.joanneum.ac.at!tab

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!news.tu-graz.ac.at!piis05.joanneum.ac.at!tab
From: tab@piis05.joanneum.ac.at (Behnam Tabatabai)
Subject: const storage class
Message-ID: <1992Oct2.123309.26547@news.tu-graz.ac.at>
Sender: news@news.tu-graz.ac.at (USENET News System)
Nntp-Posting-Host: piis05.joanneum.ac.at
Organization: Joanneum Research, Graz, Austria
X-Newsreader: Tin 1.1 PL5
Date: Fri, 2 Oct 92 12:33:09 GMT
Lines: 46