[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnubg] a warning from GCC 3.4.1
From: |
Jon Kinsey |
Subject: |
Re: [Bug-gnubg] a warning from GCC 3.4.1 |
Date: |
Wed, 15 Sep 2004 14:04:22 +0100 |
User-agent: |
Mozilla Thunderbird 0.7.2 (Windows/20040707) |
Øystein O Johansen wrote:
Hi,
I notice that GCC 3.4.1 gives a deprecation warning when I'm compiling
neuralnet.c
gcc -mms-bitfields -Os -Wall -DHAVE_CONFIG_H -I. -I.. -c -o neuralnet.o
neura
lnet.c
neuralnet.c: In function `NeuralNetCreateDirect':
neuralnet.c:389: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:390: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:391: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:392: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:394: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:395: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:406: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:408: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:410: warning: use of cast expressions as lvalues is deprecated
neuralnet.c:412: warning: use of cast expressions as lvalues is deprecated
I must say, I don't care much about this warnings. Should I care?
Probably not, I think the ++ operator is causing the warning. Try this
code instead:
extern void *NeuralNetCreateDirect( neuralnet *pnn, void *p ) {
float *fp;
int *ip = (int *)p;
pnn->cInput = *ip;
ip++;
pnn->cHidden = *ip;
ip++;
pnn->cOutput = *ip;
ip++;
pnn->nTrained = *ip;
ip++;
pnn->fDirect = TRUE;
fp = (float*)ip;
pnn->rBetaHidden = *fp;
fp++;
pnn->rBetaOutput = *fp;
fp++;
if( pnn->cInput < 1 || pnn->cHidden < 1 || pnn->cOutput < 1 ||
pnn->nTrained < 0 || pnn->rBetaHidden <= 0.0 ||
pnn->rBetaOutput <= 0.0 ) {
errno = EINVAL;
return NULL;
}
pnn->arHiddenWeight = fp;
fp += pnn->cInput * pnn->cHidden;
pnn->arOutputWeight = fp;
fp += pnn->cHidden * pnn->cOutput;
pnn->arHiddenThreshold = fp;
fp += pnn->cHidden;
pnn->arOutputThreshold = fp;
fp += pnn->cOutput;
pnn->savedBase = malloc( pnn->cHidden * sizeof( float ) );
pnn->savedIBase = malloc( pnn->cInput * sizeof( float ) );
return fp;
}
Jon
signature.asc
Description: OpenPGP digital signature