473,385 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

stylistic prototype question

What do some of you guys prefer?

static int foo(void);

int main(void)
{
return foo();
}

static int foo(void)
{
return 0;
}
or..

static int foo(void);

int main(void)
{
return foo();
}

int foo(void)
{
return 0;
}

I have been told that if I write code like the latter I'll have my fingers broken
Nov 13 '05 #1
5 3082
ne*****@tokyo.com (Mantorok Redgormor) wrote in
news:41**************************@posting.google.c om:
What do some of you guys prefer?

static int foo(void);

int main(void)
{
return foo();
}

static int foo(void)
{
return 0;
}
or..

static int foo(void);
static here...
int main(void)
{
return foo();
}

int foo(void)
But not here, just plain confusing. {
return 0;
}

I have been told that if I write code like the latter I'll have my
fingers broken


Yes, you will. Why not let the definition be the prototype?

static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum
{
return 0;
}

int main(void)
{
return foo();
}

--
- Mark ->
--
Nov 13 '05 #2
"Mark A. Odell" <no****@embeddedfw.com> wrote in
news:Xn********************************@130.133.1. 4:
static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum


Or was that Life Savers?

--
- Mark ->
--
Nov 13 '05 #3
Mark A. Odell wrote:
"Mark A. Odell" <no****@embeddedfw.com> wrote in
news:Xn********************************@130.133.1. 4:

static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum

Or was that Life Savers?


Certs.

(Well, at least it *starts* with a `C'.)

<g,d&r>
--ag
--
Artie Gold -- Austin, Texas
Oh, for the good old days of regular old SPAM.

Nov 13 '05 #4
On 29 Oct 2003 22:36:45 GMT, in comp.lang.c , "Mark A. Odell"
<no****@embeddedfw.com> wrote:
Yes, you will. Why not let the definition be the prototype? static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum


Yeah, but this means writing your code *backwards*.

In the Good Old Days we had to do that, but now we're all growed up
and are awwowed to use pwototypes all by arselves. So the code can we
in any order put, hmm? Good, this is.

Back to the the main point - your prototype should match your
definition. So broken fingers might well be meted out for the original
posting.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #5
Mark McIntyre <ma**********@spamcop.net> wrote in
news:qt********************************@4ax.com:
Yes, you will. Why not let the definition be the prototype?
static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum


Yeah, but this means writing your code *backwards*.


So putting the pieces in front of the "thing" that will use them is
backwards is it? Interesting point of view.
In the Good Old Days we had to do that, but now we're all growed up
and are awwowed to use pwototypes all by arselves. So the code can we
in any order put, hmm? Good, this is.


So in the good new days, it's better to keep two things synchronized?
Besides I did use a prototype - a definition is also a prototype.

--
- Mark ->
--
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Andrew Koenig | last post by:
Suppose I want to define a class hierarchy that represents expressions, for use in a compiler or something similar. We might imagine various kinds of expressions, classified by their top-level...
13
by: Chris Smith | last post by:
'Morning, Within the next few months, I'm going to embark upon a comparatively rather large base of JavaScript code to be called from a web browser environment. Not too awfully huge, but...
4
by: Russell Silva | last post by:
I have a class A with a member variable type vector<foo> which is initialized upon construction (no standard () constructor): class A { protected: vector<foo> foo_vector; public: A(const...
7
by: Florian Loitsch | last post by:
hi, in section 10.1.8 (Arguments Object) it is stated that the "internal ] property of the arguments object is the orginal Object prototype object, the one that is the *initial* value of...
4
by: lkrubner | last post by:
I'm reading an essay, I think one of Crockford's, and it has this example in it: function Demo() { } Demo.prototype = new Ancestor(); Demo.prototype.foo = function () { } ; Does Ancestor now...
14
by: Mantorok Redgormor | last post by:
Would this by any chance invoke undefined behavior? extern int printf(const char *, ...); int main(void) { printf("Hello\n"); return 0; } That is, providing my own printf prototype would...
21
by: Rob Somers | last post by:
Hey people, I read a good thread on here regarding the reason why we use function prototypes, and it answered most of my questions, but I wanted to double check on a couple of things, as I am...
60
by: Mark Healey | last post by:
I have a function that runs through a two dimensional array several times. 01 x=map->X; 02 do 02 { 04 y=map->Y; 05 do 05 { 06 stuff(); 07
83
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.