speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

invalid conversion from ‘int’ to enum


From: Bohdan R . Rau
Subject: invalid conversion from ‘int’ to enum
Date: Sat, 05 Dec 2009 08:09:41 +0100

On Sat, 5 Dec 2009 14:24:54 +0800, Cameron Wong <hgneng at gmail.com> wrote:
[...]
> The problem lies in following code:
>  msg_settings_old.punctuation_mode = -1;\
>  msg_settings_old.spelling_mode = -1;\
>  msg_settings_old.cap_let_recogn = -1;\
> 
> I don't understand the code, but should we use a new enum value
> instead of -1? Thanks!
[...]
> typedef enum
>    {
>        RECOGN_NONE = 0,
>        RECOGN_SPELL = 1,
>        RECOGN_ICON = 2
>    }ECapLetRecogn;

It's simple to understand.

msg_settings_old.cap_let_recogn is type EPunctMode, so you can assign only
provided values. This is C++, not C!
Try something like:

typedef enum
   {
       RECOGN_INVALID = -1,
       RECOGN_NONE = 0,
       RECOGN_SPELL = 1,
       RECOGN_ICON = 2
   }ECapLetRecogn;


ethanak
-- 
http://milena.polip.com/ - Pa pa, Ivonko!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]