Is it Ok to NOT return from a void function (MIPS toolchain)

C

Chris Dollin

Hi,
Is the following pseudo code valid for a MIPS architecture , cross-
compiled with the MIPS toolchain :
void some_function (arg1, arg 2)
{
...
Do stuff here
...
}

Notice the function is NOT returning at all ?

There's an implicit `return` at the closing brace.
 
R

raseelbhagat

Hi,
Is the following pseudo code valid for a MIPS architecture , cross-
compiled with the MIPS toolchain :
void some_function (arg1, arg 2)
{
...
Do stuff here
...
}

Notice the function is NOT returning at all ?
 
I

Ian Collins

Hi,
Is the following pseudo code valid for a MIPS architecture , cross-
compiled with the MIPS toolchain :
void some_function (arg1, arg 2)
{
...
Do stuff here
...
}

Notice the function is NOT returning at all ?
Yes it does, it falls of the end.
 
T

Thad Smith

Hi,
Is the following pseudo code valid for a MIPS architecture , cross-
compiled with the MIPS toolchain :
void some_function (arg1, arg 2)
{
...
Do stuff here
...
}

Notice the function is NOT returning at all ?

Yes, it happens all the time in embedded code: a program starts and
never returns. It stops when someone pulls the plug of the battery dies.
 
C

Chris Dollin

Thad said:
Yes, it happens all the time in embedded code: a program starts and
never returns.

[That's a lot of programs. It's a wonder any of them make progress.]

I think the OP means that the function doesn't /contain/ an explicit
`return` statement, not that it has an unbounded loop in it.

--
Is it a bird? It is a plane? No, it's: http://hpl.hp.com/conferences/juc2007/
WARNING. Various parts of this product may be more than one billion years old.

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England
 
K

Keith Thompson

Is the following pseudo code valid for a MIPS architecture , cross-
compiled with the MIPS toolchain :
void some_function (arg1, arg 2)
{
...
Do stuff here
...
}

Notice the function is NOT returning at all ?

I assume you mean that the function doesn't execute a return statement.

For a void function, reaching the closing '}' (i.e., falling off the
end of the function) does exactly the same thing as executing a
"return;" statement.

This has absolutely nothing to do with the MIPS architecture. (If it
did, we would have advised you to post in a different newsgroup.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top