Newbie needs help

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Newbie needs help

Mick Hsiao Thong Hua
Hi I'm new to mingw and programming in general. I've hit a problem where my complier says:

RandomProgram!.c: In function 'main':
RandomProgram!.c: 21: internal compiler error: in put_pending_size, at stor-layout.c:140
Please submit a full bug report.
with preprocessed source if appropriate.

This is my coding:
#include <stdio.h>

void Multiply(int Nrow, int Ncol,
                   int array[Nrow] [Ncol] 
                  )
{
 

}

int main (void)
{

void Multiply(int Nrow, int Ncol,
                   int array[Nrow] [Ncol] 
                   );

}

Considering I learnt how to install mingw from youtube. I'm guessing it's probably not a compiler error and rather some mistake I've made while installing mingw. My compiler has been working fine for all my other coding so far. Any help on how I should proceed would be much appreciated.


Get straight to the Point Find a great deal on your next car.
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Greg Chicares
[Please break lines at a reasonable length like 72 characters.
That makes it easier to quote your question in a reply. Thanks.]

On 2010-02-11 09:43Z, Mick Hsiao Thong Hua wrote:
>
> void Multiply(int Nrow, int Ncol, int array[Nrow][Ncol]){
> }
> int main (void){
> void Multiply(int Nrow, int Ncol, int array[Nrow][Ncol]);
> }

What do you expect this line
> void Multiply(int Nrow, int Ncol, int array[Nrow][Ncol]);
in the body of main() to do?

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Mick Hsiao Thong Hua

Its meant to multiply a variable 2 dimensional array by a specified number. 

I thought the full program was to large to post up, and so I decided to 
isolate what caused the compile error. Multiply doesn't cause an error, its only when I call a variable 2 dimensional array function in main that the error pops up.

I think I forgot to mention that this is in the c compiler.

Here's the Full program:

#include <stdio.h>

void displayMatrix (int Nrow, int Ncol,
                            int array[Nrow] [Ncol])
{
int row, column;

for (row = 0; row < Nrow; ++row){
     for (column = 0; column < Ncol; ++column){
     printf( "%i ", array[row] [column]);}
     printf( "\n");
}
}

void Multiply(int Nrow, int Ncol,
                   int array[Nrow] [Ncol], 
                   int scalar)
{
int row, column;

for (row = 0; row < Nrow; ++row){
     for (column = 0; column < Ncol; ++column){
     array[row] [column] = array[row] [column]*scalar; }
     
}
}

int main (void)
{
void Multiply(int Nrow, int Ncol,
                   int array[Nrow] [Ncol], 
                   int scalar);
void displayMatrix (int Nrow, int Ncol,
                            int array[Nrow] [Ncol]);
int Matrix[3] [5] = 
    {
       {3, 5, 6, 7, 4},
       {5, 6, 7, 8, 3},
       {15, 19, 23, 4, 16}
    };

printf ("Original Matrix\n");
displayMatrix (3, 5, Matrix);

printf ("Original Matrix multiplied by two\n");
Multiply (3, 5, Matrix, 2);
displayMatrix (3, 5, Matrix);

}
-----------------------------------------------------------------------------------------------------------

> Date: Thu, 11 Feb 2010 13:25:08 +0000
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [Mingw-users] Newbie needs help
>
> [Please break lines at a reasonable length like 72 characters.
> That makes it easier to quote your question in a reply. Thanks.]
>
> On 2010-02-11 09:43Z, Mick Hsiao Thong Hua wrote:
> >
> > void Multiply(int Nrow, int Ncol, int array[Nrow][Ncol]){
> > }
> > int main (void){
> > void Multiply(int Nrow, int Ncol, int array[Nrow][Ncol]);
> > }
>
> What do you expect this line
> > void Multiply(int Nrow, int Ncol, int array[Nrow][Ncol]);
> in the body of main() to do?
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users


Get straight to the Point Find a great deal on your next car.
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Uwe R.
Hi!

>Its meant to multiply a variable 2 dimensional array by a specified number.

Your syntax is wrong - that was the comment.
int FUNCTION ... is a definition.
When using it you need something like my_int FUNCTION ...

Maybe you refer to a tutorial first before starting to program.
The classical book of stoustrup is good for beginners but there are
quite nice tutorials on the web as well.

Best wishes
Uwe


___________________________
PD Dr. Uwe Rossow
TU Braunschweig
Inst. f. Angewandte Physik
Mendelssohnstr. 2
38106 Braunschweig
Fax: 0531-391 8511
Email: [hidden email]
Tel.: 0531-391 8523 (good luck!)


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Tor Lillqvist
> Your syntax is wrong -

Actually, his code passes gcc just fine, apparently gcc as an
extension allows variable size arrays, eek. (I wouldn't use such
features, though, and I was in fact surprised to see this.) Only with
-pedantic does gcc complain "ISO C90 forbids variable length array".

Still, if he is a newbie, I wonder who has taught him to write such
non-standard exotic C code?

> The classical book of stoustrup is good for beginners

What makes you think he wants to learn C++?

--tml

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Uwe R.
Hi!

> > Your syntax is wrong -
>
>Actually, his code passes gcc just fine, apparently gcc as an
>extension allows variable size arrays, eek. (I wouldn't use such
>features, though, and I was in fact surprised to see this.) Only with
>-pedantic does gcc complain "ISO C90 forbids variable length array".
>
>Still, if he is a newbie, I wonder who has taught him to write such
>non-standard exotic C code?

Hmm, maybe C is too long ago for me but the code doesnt look well
and even if it passes gcc I would be very surprised if it would run
in a deterministic way.


> > The classical book of stoustrup is good for beginners
>
>What makes you think he wants to learn C++?
>
>--tml

I would do and in fact I do (after grown up with Pascal and being
convinced that this is
the language to learn how to program)
Actually Kernighan Richie would be my choice for C and I dont remember such a
strange code in the book.

Best wishes
Uwe




___________________________
PD Dr. Uwe Rossow
TU Braunschweig
Inst. f. Angewandte Physik
Mendelssohnstr. 2
38106 Braunschweig
Fax: 0531-391 8511
Email: [hidden email]
Tel.: 0531-391 8523 (good luck!)


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Tatsh
In reply to this post by Mick Hsiao Thong Hua
In main, don't put void in your call. It needs to just be Multiply() with
arguments supplied.

You can't expect this to work as a so-called 2D array MUST have its first
dimension (call it width) defined. If you want to have a multiply() function,
pass a pointer to malloc'd space like this:

in main():
  int i;
  int **A = (int **)malloc(nrows * sizeof(int *));

  for (i = 0; i < nrows; i++) {
    A[i] = (int *)malloc(ncol * sizeof(int));
  }

  multiply(nrows, ncol, A);

Don't forget to free() any malloc'd space before exiting.

In multiply() work like a normal 2D array, but use ncol and nrows as boundaries.

multiply(int nrows, int ncols, int **A, int n) {
  int i = 0;
  int j = 0;

  /* n is what to multiply by */
  /* iterate through matrix A with a loop or recursively if possible */
  A[i][j] /* Make sure i does not exceed nrows, and j does not exceed ncols */

  /* etc etc */
}

Now please read a C book front-to-back and you will not regret it. I have some
suggestions in mind but not everything works for everyone: Obviously The C Book,
Applications Programming in C, even C for Dummies (both volumes) helped me when
I was really starting out. Do not expect this to be an overnight thing.

Mick Hsiao Thong Hua wrote:

> Hi I'm new to mingw and programming in general. I've hit a problem where
> my complier says:
>
> RandomProgram!.c: In function 'main':
> RandomProgram!.c: 21: internal compiler error: in put_pending_size, at
> stor-layout.c:140
> Please submit a full bug report.
> with preprocessed source if appropriate.
>
> This is my coding:
> #include <stdio.h>
>
> void Multiply(int Nrow, int Ncol,
>                    int array[Nrow] [Ncol]
>                   )
> {
>  
>
> }
>
> int main (void)
> {
>
> void Multiply(int Nrow, int Ncol,
>                    int array[Nrow] [Ncol]
>                    );
>
> }
>
> Considering I learnt how to install mingw from youtube. I'm guessing
> it's probably not a compiler error and rather some mistake I've made
> while installing mingw. My compiler has been working fine for all my
> other coding so far. Any help on how I should proceed would be much
> appreciated.
>
> ------------------------------------------------------------------------
> Get straight to the Point Find a great deal on your next car.
> <http://clk.atdmt.com/NMN/go/157637060/direct/01/>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users

--
Tatsh
www.tatsh.net
[hidden email]

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Tor Lillqvist
> Now please read a C book front-to-back and you will not regret it.

Well, seriously, only do this if you are actually interested in the
low-level *implementation* of general-purpose libraries, compilers,
etc tools. Or in maintaining legacy code.

For high-level programming (and I would count matrix multiplication as
such) (I know his example was matrix multiplication just with a
scalar), why would one use plain C? There are much safer languages.
(And I don't mean C++.)

(Of course, the above is just my personal opinion.)

--tml

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Mick Hsiao Thong Hua
In reply to this post by Tatsh
Thanks all Ill see if I can implement some of these solutions. 

Just to let you guys know I am learning C from a book by Stephen G. Kochan.
This problem came about while doing one of his exercises.


----------------------------------------------------------------------------------------------------

> Date: Thu, 11 Feb 2010 09:43:21 -0500
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [Mingw-users] Newbie needs help
>
> In main, don't put void in your call. It needs to just be Multiply() with
> arguments supplied.
>
> You can't expect this to work as a so-called 2D array MUST have its first
> dimension (call it width) defined. If you want to have a multiply() function,
> pass a pointer to malloc'd space like this:
>
> in main():
> int i;
> int **A = (int **)malloc(nrows * sizeof(int *));
>
> for (i = 0; i < nrows; i++) {
> A[i] = (int *)malloc(ncol * sizeof(int));
> }
>
> multiply(nrows, ncol, A);
>
> Don't forget to free() any malloc'd space before exiting.
>
> In multiply() work like a normal 2D array, but use ncol and nrows as boundaries.
>
> multiply(int nrows, int ncols, int **A, int n) {
> int i = 0;
> int j = 0;
>
> /* n is what to multiply by */
> /* iterate through matrix A with a loop or recursively if possible */
> A[i][j] /* Make sure i does not exceed nrows, and j does not exceed ncols */
>
> /* etc etc */
> }
>
> Now please read a C book front-to-back and you will not regret it. I have some
> suggestions in mind but not everything works for everyone: Obviously The C Book,
> Applications Programming in C, even C for Dummies (both volumes) helped me when
> I was really starting out. Do not expect this to be an overnight thing.
>
> Mick Hsiao Thong Hua wrote:
> > Hi I'm new to mingw and programming in general. I've hit a problem where
> > my complier says:
> >
> > RandomProgram!.c: In function 'main':
> > RandomProgram!.c: 21: internal compiler error: in put_pending_size, at
> > stor-layout.c:140
> > Please submit a full bug report.
> > with preprocessed source if appropriate.
> >
> > This is my coding:
> > #include <stdio.h>
> >
> > void Multiply(int Nrow, int Ncol,
> > int array[Nrow] [Ncol]
> > )
> > {
> >
> >
> > }
> >
> > int main (void)
> > {
> >
> > void Multiply(int Nrow, int Ncol,
> > int array[Nrow] [Ncol]
> > );
> >
> > }
> >
> > Considering I learnt how to install mingw from youtube. I'm guessing
> > it's probably not a compiler error and rather some mistake I've made
> > while installing mingw. My compiler has been working fine for all my
> > other coding so far. Any help on how I should proceed would be much
> > appreciated.
> >
> > ------------------------------------------------------------------------
> > Get straight to the Point Find a great deal on your next car.
> > <http://clk.atdmt.com/NMN/go/157637060/direct/01/>
> >
> >
> > ------------------------------------------------------------------------
> >
> > ------------------------------------------------------------------------------
> > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> > http://p.sf.net/sfu/solaris-dev2dev
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > MinGW-users mailing list
> > [hidden email]
> >
> > This list observes the Etiquette found at
> > http://www.mingw.org/Mailing_Lists.
> > We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
> >
> > _______________________________________________
> > You may change your MinGW Account Options or unsubscribe at:
> > https://lists.sourceforge.net/lists/listinfo/mingw-users
>
> --
> Tatsh
> www.tatsh.net
> [hidden email]
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users


Get straight to the Point Find a great deal on your next car.
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Jonathan Andrews
In reply to this post by Tatsh
On Thu, 2010-02-11 at 09:43 -0500, Tatsh wrote:

> In main, don't put void in your call. It needs to just be Multiply() with
> arguments supplied.
>
> You can't expect this to work as a so-called 2D array MUST have its first
> dimension (call it width) defined. If you want to have a multiply() function,
> pass a pointer to malloc'd space like this:
>
> in main():
>   int i;
>   int **A = (int **)malloc(nrows * sizeof(int *));

This is the kind of evil that gives C a bad name !  Double dereferenced
pointers and a malloc, nasty.

A more readable way is to malloc a buffer large enough, create a
structure or array and then place the array pointer or structure member
in the buffer.

http://www-ee.eng.hawaii.edu/~tep/EE160/Book/chap12/subsection2.1.1.4.html




------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Uwe R.
In reply to this post by Tor Lillqvist
Hi!


>For high-level programming (and I would count matrix multiplication as
>such) (I know his example was matrix multiplication just with a
>scalar), why would one use plain C? There are much safer languages.
>(And I don't mean C++.)
>
>(Of course, the above is just my personal opinion.)
>
>--tml

Well C is quick as especially in numerics comparable to Fortran.

Still I would not start using the one or the other.

C++ seems to be ok.
What do you mean by safer languages? Delphi, Java, Ada Python or
script lang. like mathematica?

Best wishes
Uwe


___________________________
PD Dr. Uwe Rossow
TU Braunschweig
Inst. f. Angewandte Physik
Mendelssohnstr. 2
38106 Braunschweig
Fax: 0531-391 8511
Email: [hidden email]
Tel.: 0531-391 8523 (good luck!)


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Vincent Torri


On Thu, 11 Feb 2010, Uwe Rossow wrote:

> Hi!
>
>
>> For high-level programming (and I would count matrix multiplication as
>> such) (I know his example was matrix multiplication just with a
>> scalar), why would one use plain C? There are much safer languages.
>> (And I don't mean C++.)
>>
>> (Of course, the above is just my personal opinion.)
>>
>> --tml
>
> Well C is quick as especially in numerics comparable to Fortran.

you certainly didn't compare linear algebra computations in fortran and in
C

Vincent Torri


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Tor Lillqvist
In reply to this post by Uwe R.
> What do you mean by safer languages? Delphi, Java, Ada Python or
> script lang. like mathematica?

Anything where you don't see pointers and can't get heap corruption;)
Dunno about Delphi, but those you mention would be fine probably, or
Java or C#.

--tml

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Роман Донченко
In reply to this post by Tor Lillqvist
Tor Lillqvist <[hidden email]> писал в своём письме Thu,  
11 Feb 2010 17:21:58 +0300:

>> Your syntax is wrong -
>
> Actually, his code passes gcc just fine, apparently gcc as an
> extension allows variable size arrays, eek. (I wouldn't use such
> features, though, and I was in fact surprised to see this.) Only with
> -pedantic does gcc complain "ISO C90 forbids variable length array".
>
> Still, if he is a newbie, I wonder who has taught him to write such
> non-standard exotic C code?

*cough*

Variable length arrays are a standard C99 feature.

Roman.


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Tatsh
In reply to this post by Tor Lillqvist
The parent post is without a doubt a good exercise for any programmer learning
C. First time I did matrix multiplication in C (one against another, not
scaling) I did it iteratively (and it was messy) but it took a long time and I
learned a lot from it, especially about pointers. Recursive version was much
better and teaches even more.

Tor Lillqvist wrote:

>> What do you mean by safer languages? Delphi, Java, Ada Python or
>> script lang. like mathematica?
>
> Anything where you don't see pointers and can't get heap corruption;)
> Dunno about Delphi, but those you mention would be fine probably, or
> Java or C#.
>
> --tml
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>

--
Tatsh
www.tatsh.net
[hidden email]

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Allin Cottrell
In reply to this post by Tor Lillqvist

On Thu, 11 Feb 2010, Tor Lillqvist wrote:

> > Your syntax is wrong -
>
> Actually, his code passes gcc just fine, apparently gcc as an
> extension allows variable size arrays, eek. (I wouldn't use such
> features, though, and I was in fact surprised to see this.) Only with
> -pedantic does gcc complain "ISO C90 forbids variable length array".

And only without -std=c99.  ISO C99 supports variable size arrays.
(Yeah, I know it's generally a good policy to pretend that C99
doesn't exist and abide by C90.)

Allin Cottrell

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Tor Lillqvist
In reply to this post by Роман Донченко
> Variable length arrays are a standard C99 feature.

Oh. (And how commonly do compilers implement it?) I must confess I
never bothered starting to use C99.

--tml

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Tatsh
I don't think it is bad or good really to do so. I am not sure anyone would want
to use that specific feature of C99 if they use a lot of different compilers.
The only standard feature of C99 I have used extensively is stdbool.h and
although I haven't seen the file, I believe it is just typedef enum { false=0,
true=1 } bool; . Easy to fix for any compilers that don't support it while
variable length arrays if you use it is something not so easy to fix.

Tor Lillqvist wrote:

>> Variable length arrays are a standard C99 feature.
>
> Oh. (And how commonly do compilers implement it?) I must confess I
> never bothered starting to use C99.
>
> --tml
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>

--
Tatsh
www.tatsh.net
[hidden email]

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Роман Донченко
Tatsh <[hidden email]> писал в своём  
письме Fri, 12 Feb 2010 17:17:37 +0300:

> I don't think it is bad or good really to do so. I am not sure anyone  
> would want
> to use that specific feature of C99 if they use a lot of different  
> compilers.
> The only standard feature of C99 I have used extensively is stdbool.h and
> although I haven't seen the file, I believe it is just typedef enum {  
> false=0,
> true=1 } bool; .

Actually, it's:

#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1

_Bool is the native boolean type.


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Newbie needs help

Keith Marshall
On Friday 12 February 2010 14:46:55 Роман Донченко wrote:
> Actually, it's:
>
> #define bool _Bool
> #define true 1
> #define false 0
> #define __bool_true_false_are_defined 1

Actually, in MinGW it isn't!  According to POSIX and ISO-C99, it
should be thus; however, there appears to be no stdbool.h in MinGW.

Perhaps someone would care to provide a patch, to add it?

--

Regards,
Keith.

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
12