Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > What is the use of static function in C?

Reply
Thread Tools

What is the use of static function in C?

 
 
pete
Guest
Posts: n/a
 
      11-16-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>
> vishnu schrieb:
>
> > Hi friend,
> > i have a problem in my program what is the use of
> > static function in C lang?
> > plz help me

>
> You must avoid using static functions
> at all costs if there are dynamic
> functions available! Use dynamic functions whenever possible.


static functions are a feature of standard C.
"dynamic functions" means nothing in the context of standard C.

--
pete
 
Reply With Quote
 
 
 
 
Chris Hills
Guest
Posts: n/a
 
      11-16-2005
In article <dl72j5$60v$(E-Mail Removed)-infra.bt.com>, Malcolm
<(E-Mail Removed)> writes
>


>The other point is that runtime efficiency isn't as important as it was.


Absolutely un-true!

>Most computers nowadays are fast enough, and a good program is one that does
>what it says and is easy to use, not one that responds quickly.


Most computers on the planet are 8 bit micros with 256 RAM and 64K code
space..... At one time there were 3 or 4 in every PC.

In embedded systems (ie vitally *ANYTHING* that has electrical power
these days) still work on the smaller the memory the better. The cost of
adding a 1 dollar memory chip on to a system can cost 2000 USD in
engineering time and 100,000 USD a year to a project producing 50K units

In a car if you added an additional memory chip to each of the 100 MCU
in the system you will be adding 20,000 USD to the NRE of the car. Then
the productions costs would go up by 200 USD per car...

(all figures for illustration only and are approximate based on 20 years
experience)


--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ (E-Mail Removed) www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



 
Reply With Quote
 
 
 
 
quetzalcotl@consultant.com
Guest
Posts: n/a
 
      11-16-2005

pete schrieb:

> (E-Mail Removed) wrote:
> >
> > vishnu schrieb:
> >
> > > Hi friend,
> > > i have a problem in my program what is the use of
> > > static function in C lang?
> > > plz help me

> >
> > You must avoid using static functions
> > at all costs if there are dynamic
> > functions available! Use dynamic functions whenever possible.

>
> static functions are a feature of standard C.
> "dynamic functions" means nothing in the context of standard C.


Did I say it meant anything?

 
Reply With Quote
 
Clark S. Cox III
Guest
Posts: n/a
 
      11-16-2005
On 2005-11-16 12:19:20 -0500, (E-Mail Removed) said:

>
> pete schrieb:
>
>> (E-Mail Removed) wrote:
>>>
>>> vishnu schrieb:
>>>
>>>> Hi friend,
>>>> i have a problem in my program what is the use of
>>>> static function in C lang?
>>>> plz help me
>>>
>>> You must avoid using static functions
>>> at all costs if there are dynamic
>>> functions available! Use dynamic functions whenever possible.

>>
>> static functions are a feature of standard C.
>> "dynamic functions" means nothing in the context of standard C.

>
> Did I say it meant anything?


Well, by using it, you certainly implied that it meant something.
Unless, that is, you're in the habit of using meaningless terms.

Perhaps you should clarify what it is yea meant when you said "dynamic
functions".

--
Clark S. Cox, III
(E-Mail Removed)

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      11-16-2005
pete <(E-Mail Removed)> writes:
> (E-Mail Removed) wrote:
>> vishnu schrieb:
>>
>> > Hi friend,
>> > i have a problem in my program what is the use of
>> > static function in C lang?
>> > plz help me

>>
>> You must avoid using static functions
>> at all costs if there are dynamic
>> functions available! Use dynamic functions whenever possible.

>
> static functions are a feature of standard C.
> "dynamic functions" means nothing in the context of standard C.


I think quetzalcotl was trying to provide an appropriate level of help
to someone asking about a homework problem.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Emmanuel Delahaye
Guest
Posts: n/a
 
      11-16-2005
(E-Mail Removed) a écrit :
> Did I say it meant anything?


** Troll Alert ***

--
A+

Emmanuel Delahaye
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      11-16-2005
On Wed, 16 Nov 2005 14:22:43 +0000, in comp.lang.c , Chris Hills
<(E-Mail Removed)> wrote:

>In article <dl72j5$60v$(E-Mail Removed)-infra.bt.com>, Malcolm
><(E-Mail Removed)> writes
>>

>
>>The other point is that runtime efficiency isn't as important as it was.

>
>Absolutely un-true!


Even setting aside the microcontroller aspect, this is dangerous, and
I sincerely hope that CS schools don't teach it.

I have a serious problem at work with programmers assuming unlimited
resources - about 2% of our overnight processing now consumes more
than 4GB of memory. If you've ever tried sourcing 16GB of memory for a
new Sun server, you'll know that this is an expensive mistake...

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
quetzalcotl@consultant.com
Guest
Posts: n/a
 
      11-17-2005

Clark S. Cox III schrieb:

> On 2005-11-16 12:19:20 -0500, (E-Mail Removed) said:
>
> >
> > pete schrieb:
> >
> >> (E-Mail Removed) wrote:
> >>>
> >>> vishnu schrieb:
> >>>
> >>>> Hi friend,
> >>>> i have a problem in my program what is the use of
> >>>> static function in C lang?
> >>>> plz help me
> >>>
> >>> You must avoid using static functions
> >>> at all costs if there are dynamic
> >>> functions available! Use dynamic functions whenever possible.
> >>
> >> static functions are a feature of standard C.
> >> "dynamic functions" means nothing in the context of standard C.

> >
> > Did I say it meant anything?

>
> Well, by using it, you certainly implied that it meant something.
> Unless, that is, you're in the habit of using meaningless terms.


I'm in the habit of giving appropriate answers to stupid questions. It
is obvious to me that the OP knows near to nothing about functions in C
or about the effect of the keyword static. In other words, he knows
almost nothing. If he knew about those topics, he could easily infer
what the difference between

int f() { .. }

and

static int f() { ... }

is. It would be another case, if he asked like so: "I know, that static
items (not just functions) cannot be seen from other compilation units.
I just can't imagine how this is useful. Please enlighten me."

Another, albeit less irritating appropriate answer could have been:
"Well, in

static int f(int a, int b) { return a+b; }

I define a static function that computes the sum of two integers, a and
b. This static function can then be used only for that purpose. If, for
example, you want to use a static function to add two doubles, x and y,
you cannot use f. Fortunately, it is possible in most cases to define
another static function that does just what you want to use it for."

 
Reply With Quote
 
Chris Hills
Guest
Posts: n/a
 
      11-17-2005
In article <(E-Mail Removed). com>,
(E-Mail Removed) writes
>
>Clark S. Cox III schrieb:
>
>> On 2005-11-16 12:19:20 -0500, (E-Mail Removed) said:
>>
>> >
>> > pete schrieb:
>> >
>> >> (E-Mail Removed) wrote:
>> >>>
>> >>> vishnu schrieb:
>> >>>
>> >>>> Hi friend,
>> >>>> i have a problem in my program what is the use of
>> >>>> static function in C lang?
>> >>>> plz help me
>> >>>
>> >>> You must avoid using static functions
>> >>> at all costs if there are dynamic
>> >>> functions available! Use dynamic functions whenever possible.
>> >>
>> >> static functions are a feature of standard C.
>> >> "dynamic functions" means nothing in the context of standard C.
>> >
>> > Did I say it meant anything?

>>
>> Well, by using it, you certainly implied that it meant something.
>> Unless, that is, you're in the habit of using meaningless terms.

>
>I'm in the habit of giving appropriate answers to stupid questions. It
>is obvious to me that the OP knows near to nothing about functions in C
>or about the effect of the keyword static. In other words, he knows
>almost nothing. If he knew about those topics,



If he knew he would not be asking. static functions and static variables
are often confused by students and new programmers (and many old ones
too

I have noticed that there is a far more vindictive streak in this NG
these days compared to when I started reading it 15 off years ago.

Whilst no one wants to do home work for some one you can always point
them in the right direction of study.

When people come here to ask "the experts" they don't expect them to
behave like self righteous pompous twats.





--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ (E-Mail Removed) www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



 
Reply With Quote
 
David Resnick
Guest
Posts: n/a
 
      11-17-2005

Chris Hills wrote:
> In article <(E-Mail Removed). com>,
> >> >>> vishnu schrieb:
> >> >>>
> >> >>>> Hi friend,
> >> >>>> i have a problem in my program what is the use of
> >> >>>> static function in C lang?
> >> >>>> plz help me
> >> >>>


>
> I have noticed that there is a far more vindictive streak in this NG
> these days compared to when I started reading it 15 off years ago.
>
> Whilst no one wants to do home work for some one you can always point
> them in the right direction of study.
>
> When people come here to ask "the experts" they don't expect them to
> behave like self righteous pompous twats.
>


<OT> Yes. Though vague questions much like above, written in exactly
that
style and wording, sometimes seem to be trolls, perhaps by a
single
person (chellapa?). Mostly coming from gmail accounts over
google
groups (yes, I am too)

Some recent examples
>>sabarish:
>>Hi friend,
>>what is the use of function pointer in c language and where it is
>>useful?
>>tell with simple example...?
>>plz help me.


>>jkwagh
>>Hi friend,
>>I am currently working on a Parser project in which i want to parse
>>HTML and asp pages into .c file. So can you plz help me to do that?
>>Thanks in advanced
>>Jayant


>>chellapa
>>hi all
>>I need to write a program to find mac address of a my computer using
>>libaries, is
>>this possible? How?
>>thanks


I don't think they are worth a real answer -- they
indicate a complete lack of respect for the time of those
being
questioned in that the poster has put no effort into the
matter
themselves and has not tried to find the right place to ask
the question. While rude/cruel responses aren't called for,
neither
are thoughtful answer to thoughtless questions. Perhaps the
correct answer to these posts is just a url:
http://www.catb.org/~esr/faqs/smart-questions.html
</OT>

-David

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call a non static function from a static function bhattacharjeesoft@gmail.com C++ 2 08-06-2007 11:03 AM
Can a static function declaration conflict with a non-static declaration? nospam_timur@tabi.org C Programming 4 12-12-2006 10:26 PM
How can I use a function pointer to non-static member function of a class. Assertor C++ 1 03-09-2006 04:18 PM
how to use non-static member function as comparision function infind_if? John Black C++ 1 05-31-2004 12:22 AM
Re: Detecting static or non-static member function? Victor Bazarov C++ 0 06-23-2003 09:29 PM



Advertisments