Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Possible C shorthand -- please help!

Reply
Thread Tools

Possible C shorthand -- please help!

 
 
Flash Gordon
Guest
Posts: n/a
 
      01-16-2009
Richard wrote:
> Flash Gordon <(E-Mail Removed)> writes:
>
>> blargg wrote:
>>> August Karlstrom wrote:
>>>> http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>>>>> Hi
>>>>>
>>>>> Hope you can help me with this one. Is the following "C" code:
>>>>>
>>>>> short somevar, MethodName();
>>>>>
>>>>> shorthand for:
>>>>>
>>>>> short somevar = MethodName();
>>>>>
>>>>>
>>>>> where the MethodName() returns a short?
>>>> No, it's a shorthand for
>>>>
>>>> short somevar;
>>>> short MethodName();
>>> That's still shorthand.
>>>
>>> extern short int somevar;
>>> extern short int MethodName( ... );
>>>
>>> is fully longhand (drop the extern for somevar if this at function scope).

>> Drop the extern for somevar under ALL conditions. I.e. the following
>> requires a diagnostic and on many (most) implementations it will be a
>> fatal diagnostic.

>
> Not under all conditions at all. If somevar is in another unit then
> extern is fine.


I didn't say that it was impossible to use extern on a variable at file
scope. I was correcting the claim that that there are any conditions in
which "short int somevar" is shorthand for (i.e. means the same as)
"extern short int somevar". The code below is merely and requirement for
a diagnostic (where it was implicit that it was the entire code for the
program) was merely an example to make the point that at file scope the
"extern" changed the meaning.

>> extern short somevar;
>> int main(void)
>> {
>> return somevar;
>> }
>>
>> However, if you get rid of the extern it is correct and will work.

--
Flash Gordon
 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      01-17-2009
"(E-Mail Removed)" wrote:
>
> Hope you can help me with this one. Is the following "C" code:
>
> short somevar, MethodName();
>
> shorthand for:
>
> short somevar = MethodName();
>
> where the MethodName() returns a short?


No. I suggest you get a good book on C fundamentals, such as
K&RII, and read it.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
 
Reply With Quote
 
 
 
 
Richard
Guest
Posts: n/a
 
      01-17-2009
CBFalconer <(E-Mail Removed)> writes:

> "(E-Mail Removed)" wrote:
>>
>> Hope you can help me with this one. Is the following "C" code:
>>
>> short somevar, MethodName();
>>
>> shorthand for:
>>
>> short somevar = MethodName();
>>
>> where the MethodName() returns a short?

>
> No. I suggest you get a good book on C fundamentals, such as
> K&RII, and read it.


Q: how can you not have seen the other replies and not know that was
already recommended? You use motzarella and it is instant near enough.


 
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
C conditional statement shorthand puzzle -- please help!! almurph@altavista.com C Programming 5 01-29-2009 01:56 PM
Shorthand for Property declaration in VB David W ASP .Net 0 01-17-2007 07:44 PM
Shorthand for namespaces Foxpointe XML 4 10-31-2006 09:41 PM
foreach shorthand unspammable@gmail.com C++ 2 03-25-2005 10:38 PM
kiwi biz q_'n <== Teeline shorthand for question Quean Computer Support 2 12-23-2004 07:08 AM



Advertisments