public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Achim Gaedke <Achim.Gaedke@uni-koeln.de>
To: "Matthew J. Doller" <mdoller@wpi.edu>
Cc: gsl-discuss <gsl-discuss@sources.redhat.com>
Subject: Re: stupid question
Date: Wed, 19 Dec 2001 13:20:00 -0000	[thread overview]
Message-ID: <3C040214.7A1A14A1@uni-koeln.de> (raw)
In-Reply-To: <1006893998.25374.4.camel@mrburns>

Here is the code... It is changed a little bit, in order to reflect a compilable
program. Do not execute it!

#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>

gsl_matrix * matrix_return_upper ( gsl_matrix *m ){
  
  int num_rows, num_cols;
  gsl_matrix * return_matrix;

  num_rows = m->size1;
  num_cols = m->size2;

  return_matrix = gsl_matrix_alloc ( num_rows , num_cols );

  return (gsl_matrix *) return_matrix;
}

int main () {
  (void*)matrix_return_upper((gsl_matrix*)NULL);
  return 0;
}

it does compile without problems under redhat7.2 and under gsl-1.0 with
gcc-3.0.2.
Maybe you come from c++ and are new to c - like me.
Be careful: Declarations have to be done before using the variables.

Yours, Achim


"Matthew J. Doller" schrieb:
> 
> can someone shed a tiny bit of light on why this seemingly simple
> routine is not compiling for me?
> 
> --- BEGIN CODE ---
> 
> #include "matrix-generic.h"
> #include <gsl/gsl_matrix.h>
> #include <gsl/gsl_vector.h>
> 
> gsl_matrix * matrix_return_upper ( gsl_matrix *m ){
> 
>   int num_rows, num_cols, error;
> 
>   num_rows = m->size1;
>   num_cols = m->size2;
> 
>   gsl_matrix * return_matrix = gsl_matrix_alloc ( num_rows , num_cols );
> 
>   ...
>   ...
> 
>   return (gsl_matrix *) return_matrix;
> }
> 
> --- END CODE ---
> 
> compile command:
> gcc -o mytest matrix-generic.c -lgsl -lgslcblas -lm
> 
> compile errors:
> matrix-generic.c: In function `matrix_return_upper':
> matrix-generic.c:30: parse error before `*'
> 
> the * in question is from the line:
> gsl_matrix * return_matrix = gsl_matrix_alloc ( num_rows , num_cols );
> 
> for now, i have stripped out all the rest of the code after that line to
> simplify debugging.  please tell me that i'm over looking something
> simple.
> 
> thanks in advance
> matt
> 
> --
> Matthew J. Doller
> mdoller@wpi.edu
> http://www.wpi.edu/~mdoller

WARNING: multiple messages have this Message-ID
From: Achim Gaedke <Achim.Gaedke@uni-koeln.de>
To: "Matthew J. Doller" <mdoller@wpi.edu>
Cc: gsl-discuss <gsl-discuss@sources.redhat.com>
Subject: Re: stupid question
Date: Tue, 20 Nov 2001 02:00:00 -0000	[thread overview]
Message-ID: <3C040214.7A1A14A1@uni-koeln.de> (raw)
Message-ID: <20011120020000.g0Q0PN44VdsEHmJF4TqCtEIESpo_DwsiR5WRjgm7l5Q@z> (raw)
In-Reply-To: <1006893998.25374.4.camel@mrburns>

Here is the code... It is changed a little bit, in order to reflect a compilable
program. Do not execute it!

#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>

gsl_matrix * matrix_return_upper ( gsl_matrix *m ){
  
  int num_rows, num_cols;
  gsl_matrix * return_matrix;

  num_rows = m->size1;
  num_cols = m->size2;

  return_matrix = gsl_matrix_alloc ( num_rows , num_cols );

  return (gsl_matrix *) return_matrix;
}

int main () {
  (void*)matrix_return_upper((gsl_matrix*)NULL);
  return 0;
}

it does compile without problems under redhat7.2 and under gsl-1.0 with
gcc-3.0.2.
Maybe you come from c++ and are new to c - like me.
Be careful: Declarations have to be done before using the variables.

Yours, Achim


"Matthew J. Doller" schrieb:
> 
> can someone shed a tiny bit of light on why this seemingly simple
> routine is not compiling for me?
> 
> --- BEGIN CODE ---
> 
> #include "matrix-generic.h"
> #include <gsl/gsl_matrix.h>
> #include <gsl/gsl_vector.h>
> 
> gsl_matrix * matrix_return_upper ( gsl_matrix *m ){
> 
>   int num_rows, num_cols, error;
> 
>   num_rows = m->size1;
>   num_cols = m->size2;
> 
>   gsl_matrix * return_matrix = gsl_matrix_alloc ( num_rows , num_cols );
> 
>   ...
>   ...
> 
>   return (gsl_matrix *) return_matrix;
> }
> 
> --- END CODE ---
> 
> compile command:
> gcc -o mytest matrix-generic.c -lgsl -lgslcblas -lm
> 
> compile errors:
> matrix-generic.c: In function `matrix_return_upper':
> matrix-generic.c:30: parse error before `*'
> 
> the * in question is from the line:
> gsl_matrix * return_matrix = gsl_matrix_alloc ( num_rows , num_cols );
> 
> for now, i have stripped out all the rest of the code after that line to
> simplify debugging.  please tell me that i'm over looking something
> simple.
> 
> thanks in advance
> matt
> 
> --
> Matthew J. Doller
> mdoller@wpi.edu
> http://www.wpi.edu/~mdoller

  parent reply	other threads:[~2001-12-19 13:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-19 13:20 Matthew J. Doller
2001-11-19 10:26 ` Matthew J. Doller
2001-12-19 13:20 ` Achim Gaedke [this message]
2001-11-20  2:00   ` Achim Gaedke
2009-10-11 13:52 Stupid question Robert G. Brown
2009-10-11 14:06 ` Robert G. Brown
2009-10-11 16:49 ` John D Lamb
2009-10-11 17:42 ` Andrew W. Steiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C040214.7A1A14A1@uni-koeln.de \
    --to=achim.gaedke@uni-koeln.de \
    --cc=gsl-discuss@sources.redhat.com \
    --cc=mdoller@wpi.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).