1. Help with a little C

I need a little help with just what this line of code does

boolean G_CheckDemoStatus (void);

i know what boolean means in math but what does it do here???

Grape Vine

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view message » categorize

2. Re: Help with a little C

In C, a boolean is a true or false value.

EUPHORIA at LISTSERV.MUOHIO.EDU wrote:

> I need a little help with just what this line of code does
>
> boolean G_CheckDemoStatus (void);
>
> i know what boolean means in math but what does it do here???
>
> Grape Vine
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com

--
Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/

new topic     » goto parent     » topic index » view message » categorize

3. Re: Help with a little C

Grape Vine <chat_town at HOTMAIL.COM> wrote:

> I need a little help with just what this line of code does
>
> boolean G_CheckDemoStatus (void);
>
> i know what boolean means in math but what does it do here???
>
> Grape Vine

"boolean", as it appears here in C, defines the data type for the value
returned from the function. We don't have to do this in Euphoria, so that's
probably why it threw you.

If I recall my C class correctly, this is how C knows the format of the data
it's passing back from the function. Either that, or it helps the compiler
convert data from one type to another if the receiving variable is a
different type (or class, or whatever). As this is all from memory, I may be
somewhat wrong. But I think that's the gist of it.

Hope this helps,

Gabriel Boehme

new topic     » goto parent     » topic index » view message » categorize

4. Re: Help with a little C

Yep, basically, that's what it is..  The simplest way I can explain it is by
saying that

   boolean G_CheckDemoStatus(void);

is a function prototype.  The format goes like this:

   ReturnType FunctionName(Parameters);

Where ReturnType is the type of the return value (any C data types or types you
define yourself).  If this is omitted, then int is the default return type.  A
lot of programmers (such as me) still choose not to omit the return type and
explicitly declare the return type as int, because it's easier to read (at least
in my opinion). FunctionName is the name of the function, and Parameters
contains the parameter list..  void means no parameters, otherwise, parameter
lists are declared the same way as in Euphoria (heh...  it's easier for me to
explain when i do it like that)..  If you use an ellipsis (...), then the
compiler knows that the function is going to deal with an unlimited number of
parameters, but when you do that, to keep your program compatible with the ANSI
C standard, you have to have at least one fixed parameter..  To keep it simple,
I won't explain why.  It might be a little intimidating, but you'll get the hang
of it (assuming you're learning C.. heheh)..

   Austin C. (aka The AfterBeat)

"Boehme, Gabriel" wrote:

> Grape Vine <chat_town at HOTMAIL.COM> wrote:
>
> > I need a little help with just what this line of code does
> >
> > boolean G_CheckDemoStatus (void);
> >
> > i know what boolean means in math but what does it do here???
> >
> > Grape Vine
>
> "boolean", as it appears here in C, defines the data type for the value
> returned from the function. We don't have to do this in Euphoria, so that's
> probably why it threw you.
>
> If I recall my C class correctly, this is how C knows the format of the data
> it's passing back from the function. Either that, or it helps the compiler
> convert data from one type to another if the receiving variable is a
> different type (or class, or whatever). As this is all from memory, I may be
> somewhat wrong. But I think that's the gist of it.
>
> Hope this helps,
>
> Gabriel Boehme

new topic     » goto parent     » topic index » view message » categorize

5. Re: Help with a little C

boolean G_CheckDemoStatus (void);

Is a declaration of a function whose name is G_CheckDemoStatus

The (void) means that it takes no paramters when you call it

the function returns a boolen value ( true or false ) or ( 1 or 0 ) when

called.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Help with a little C

I see....how do i do this in euphoria? I understand what this operator
does but HOW it does it....like C = A (boolean operator of some kind)
B...i dont see how this is happening in C....(i dont wish to learn C to
program in it..just enough to port from it to E)


>Date:         Fri, 12 Feb 1999 13:46:00 -0600
>Reply-To:     Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
>From:         "Boehme, Gabriel" <gboehme at MUSICLAND.COM>
>Subject:      Re: Help with a little C
>To:           EUPHORIA at LISTSERV.MUOHIO.EDU
>
>Grape Vine <chat_town at HOTMAIL.COM> wrote:
>
>> I need a little help with just what this line of code does
>>
>> boolean G_CheckDemoStatus (void);
>>
>> i know what boolean means in math but what does it do here???
>>
>> Grape Vine
>
>"boolean", as it appears here in C, defines the data type for the value
>returned from the function. We don't have to do this in Euphoria, so
that's
>probably why it threw you.
>
>If I recall my C class correctly, this is how C knows the format of the
data
>it's passing back from the function. Either that, or it helps the
compiler
>convert data from one type to another if the receiving variable is a
>different type (or class, or whatever). As this is all from memory, I
may be
>somewhat wrong. But I think that's the gist of it.
>
>Hope this helps,
>
>Gabriel Boehme
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

7. Re: Help with a little C

>I need a little help with just what this line of code does
>
>boolean G_CheckDemoStatus (void);
>
>i know what boolean means in math but what does it do here???


Since it's a prototype, you will need to look for where the function,
G_Check_DemoStatus() is located. It should look something like this:

boolean G_CheckDemoStatus (void)
{
    // Code
    return result;
}

Porting to Euphoria, you won't need the prototype, but just do this:

function G_CheckDemoStatus()
    -- Code
   return result
end function

boolean just means only allocate enough memory for 1 bit. (I think.. that's
all it needs, anyway.) result will be true or false in the function when it
is called. I assume the function returns true if everything is ok, false
otherwise. Either that, or true when it's not ok...

This answer your question? smile

new topic     » goto parent     » topic index » view message » categorize

8. Re: Help with a little C

Yes it does...thank you...


>Date:         Fri, 12 Feb 1999 17:32:18 -0500
>Reply-To:     Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
>From:         Robert Pilkington <pilking at BELLATLANTIC.NET>
>Subject:      Re: Help with a little C
>To:           EUPHORIA at LISTSERV.MUOHIO.EDU
>
>>I need a little help with just what this line of code does
>>
>>boolean G_CheckDemoStatus (void);
>>
>>i know what boolean means in math but what does it do here???
>
>
>Since it's a prototype, you will need to look for where the function,
>G_Check_DemoStatus() is located. It should look something like this:
>
>boolean G_CheckDemoStatus (void)
>{
>    // Code
>    return result;
>}
>
>Porting to Euphoria, you won't need the prototype, but just do this:
>
>function G_CheckDemoStatus()
>    -- Code
>   return result
>end function
>
>boolean just means only allocate enough memory for 1 bit. (I think..
that's
>all it needs, anyway.) result will be true or false in the function
when it
>is called. I assume the function returns true if everything is ok,
false
>otherwise. Either that, or true when it's not ok...
>
>This answer your question? smile
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

9. Re: Help with a little C

Grape Vine <chat_town at HOTMAIL.COM> wrote:

>I need a little help with just what this line of code does
>
>boolean G_CheckDemoStatus (void);
>
>i know what boolean means in math but what does it do here???
>
>Grape Vine


In Pascal this would be:

    function G_CheckDemoStatus : boolean;

Just to confuse the issue.  :)

new topic     » goto parent     » topic index » view message » categorize

10. Re: Help with a little C

That dont confuse me..if C had it stated that way i think it makes more
sence(to me anyway)...i can see that the funtion does something..in c it
looks like something is being done to the function...

Grape



>Date:         Mon, 15 Feb 1999 11:01:50 -0800
>Reply-To:     Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
>From:         Quality <quality at ANNEX.COM>
>Subject:      Re: Help with a little C
>To:           EUPHORIA at LISTSERV.MUOHIO.EDU
>
>Grape Vine <chat_town at HOTMAIL.COM> wrote:
>
>>I need a little help with just what this line of code does
>>
>>boolean G_CheckDemoStatus (void);
>>
>>i know what boolean means in math but what does it do here???
>>
>>Grape Vine
>
>
>In Pascal this would be:
>
>    function G_CheckDemoStatus : boolean;
>
>Just to confuse the issue.  :)
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

11. Re: Help with a little C

|>Subject:      Re: Help with a little C
|>>I need a little help with just what this line of code does
|>>
|>>boolean G_CheckDemoStatus (void);
|>>
|>>i know what boolean means in math but what does it do here???
|>>


The following 'C' statement:

boolean G_CheckDemoStatus (void);

 when translated into English would be something like:

There is a function called "G_CheckDemoStatus" that takes no parameters and
returns a "boolean" data type.

However, there is no native data type of boolean in 'C', so my guess is that
there is an earlier line of code (maybe contained in an "include" file) that
defines what the code author meant by "boolean".

Maybe something like:
  #define boolean int

which means that boolean is an alias for "int", an integer.

It is a common convention in 'C' programming to return an integer with a
value of zero to mean "false" and non-zero (often -1) to mean true.


cheers,
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu