Jump to content

Error: Function Cant Have Bit Return Type


Recommended Posts

Hi everybody!

 

Can somebody explain, why it isnt possible to have a function with a boolean return type within SourceBoostC?

 

I declared something like:

 

bool checkSomething(void);

 

and used it:

 

checkSomething()

{

...

OK = true;

...

 

return OK;

}

 

Thx

Link to post
Share on other sites
Hi everybody!

 

Can somebody explain, why it isnt possible to have a function with a boolean return type within SourceBoostC?

 

I declared something like:

 

bool checkSomething(void);

 

and used it:

 

checkSomething()

{

...

OK = true;

...

 

return OK;

}

 

Thx

 

 

this does not work either

 

bool willCompile() {

return true;

}

 

but you could return a unsigned char, and try if( aChar ).....

 

this does compile:

 

unsigned char willCompile() {

return true;

}

 

but what does it return?

 

 

Wikipedia says:

 

To this day, Boolean values are commonly represented by integers in C programs. The comparison operators (' > ', '==', etc.) are defined to return a signed integer (int) result, either zero (for false) or nonzero (for true). The Boolean operators (&&, ||) and conditional statements (if, while) in C operate on integer values, with the same interpretation. For example, the following C code

Link to post
Share on other sites
Hi everybody!

 

Can somebody explain, why it isnt possible to have a function with a boolean return type within SourceBoostC?

 

I declared something like:

 

bool checkSomething(void);

 

and used it:

 

checkSomething()

{

...

OK = true;

...

 

return OK;

}

 

Thx

 

This feature is on our todo list. Meanwhile please use unsigned char return type instead of bool and compare it against zero to check if call failed or succeeded.

 

Regards,

Pavel

Link to post
Share on other sites
Hi,

 

I use a chance and ask what about bits and bools in structure? These aren't supported currently. Why? Plans to add support for them?

 

Yes this is planned for version 7 release.

 

Regards,

Pavel

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...