flat assembler
Message board for the users of flat assembler.

Index > Heap > Allow return from functions with no return type?


Allow returning a value from functions with no return type?
Yes, functions with no declared return type returns INT
0%
 0%  [ 0 ]
No, they should always return something undefined
40%
 40%  [ 2 ]
No, and they can't be used as part of an expression (a = Sub() not allowed)
60%
 60%  [ 3 ]
Total Votes : 5

Author
Thread Post new topic Reply to topic
Plue



Joined: 15 Dec 2005
Posts: 151
Plue
Hi
I am making a compiler for a basic-like language (with some bits from Pascal and Object Pascal). I'm not sure if I should allow a return value from functions with no return type. What do you think?

Also, what keyword should I use, and should I use a separate keyword for functions with no return type?
Candidates:
Procedure
Function
Sub
Proc
Func

_________________
Roses are red
Violets are blue
Some poems rhyme
And some don't.
Post 10 Dec 2006, 11:24
View user's profile Send private message Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
You should be able to return in a typeless ("void") procedure, "return;", to leave for whatever reason.

_________________
redghost.ca
Post 10 Dec 2006, 16:04
View user's profile Send private message AIM Address MSN Messenger Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
If it's like basic use sub for no return type and function for return type - so if a sub was told to return a value, the compiler should moan.
Post 10 Dec 2006, 21:16
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.