illinois-ml-nlp-users AT lists.siebelschool.illinois.edu
Subject: Support for users of CCG software closed 7-27-20
List archive
- From: Lars Buitinck <larsmans AT gmail.com>
- To: Steven Corman <steve.corman AT asu.edu>, illinois-ml-nlp-users <illinois-ml-nlp-users AT cs.uiuc.edu>
- Subject: Re: [Illinois-ml-nlp-users] Fwd: FEX compile errors
- Date: Tue, 10 May 2011 23:56:27 +0200
- List-archive: <http://lists.cs.uiuc.edu/pipermail/illinois-ml-nlp-users>
- List-id: Support for users of CCG software <illinois-ml-nlp-users.cs.uiuc.edu>
2011/5/10 Steven Corman
<steve.corman AT asu.edu>:
> That did fix it. Of course, every time I fix one of these problems another
> one is revealed :-( Now what I have looks like a bona fide bug rather than
> a missing header file. It is in a function in sensor.cpp:
>
> void SensorHasHyphen::Extract( Sentence &sentence, RawFeatureSet &outSet,
> int rec, int targLoc )
> {
> StringVector inSet = sentence[rec].words;
> for(StringVector::iterator pWord = inSet.begin();
> pWord != inSet.end(); pWord++)
> {
> string feat;
> char *tmp=NULL;
> if (pWord->length() > 1)
> {
> tmp = strrchr((*pWord).c_str(),'-');
> if( tmp != NULL)
> feat = "hyphen";
> }
>
> if (feat.length() > 0)
> Output(outSet, feat, targLoc);
> }
> }
>
> On the line beginning with tmp= it is throwing "invalid conversion from
> const char* to char* From some C programming I did (LONG ago) I recall
> that this happens when you try to treat a constant as a variable, but
> figuring out how that is happening here is above my pay grade! Can you see
> what's wrong?
Yep, that's it. tmp should have been a const char *.
(In C, strrchr always returns char *; in C++ it's overloaded so that
when the first argument is const char *, then the return value is
const as well. The code seems to rely on the old C behavior, which was
a wart in the language anyway.)
- [Illinois-ml-nlp-users] FEX compile errors, Steven Corman, 05/10/2011
- Message not available
- [Illinois-ml-nlp-users] Fwd: FEX compile errors, Lars Buitinck, 05/10/2011
- Re: [Illinois-ml-nlp-users] Fwd: FEX compile errors, Steven Corman, 05/10/2011
- Message not available
- Message not available
- Re: [Illinois-ml-nlp-users] Fwd: FEX compile errors, Lars Buitinck, 05/10/2011
- Message not available
- Re: [Illinois-ml-nlp-users] Fwd: FEX compile errors, Lars Buitinck, 05/11/2011
- Re: [Illinois-ml-nlp-users] Fwd: FEX compile errors, Lars Buitinck, 05/10/2011
- Message not available
- Message not available
- Re: [Illinois-ml-nlp-users] Fwd: FEX compile errors, Steven Corman, 05/10/2011
- [Illinois-ml-nlp-users] Fwd: FEX compile errors, Lars Buitinck, 05/10/2011
- Message not available
Archive powered by MHonArc 2.6.16.