Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > I need your advices about C prg.

Reply
Thread Tools

I need your advices about C prg.

 
 
Rui Maciel
Guest
Posts: n/a
 
      04-25-2013
James Dow Allen wrote:

> A straightforward general question is asked here
> ... and almost half the posts deal with the pressing
> issue:
> To void main or not to void; that is the question.
>
> Wow. Just ... Wow!


The void main issue is actually relevant. It is a Litmus test to infer if a
publication actually complies with the standard or instead is a broken mess.
If someone delves into the language by relying on a broken mess of a manual
then odds are they are bound to experience problems caused by broken code
being passed off as working examples.


Rui Maciel
 
Reply With Quote
 
 
 
 
Malcolm McLean
Guest
Posts: n/a
 
      04-25-2013
On Thursday, April 25, 2013 2:19:14 PM UTC+1, James Kuyper wrote:
> On 04/25/2013 08:42 AM, Johannes Bauer wrote:
>
> In this newsgroup I've talked with a number of people who thought that
> most, if not all, current C programming is being done for embedded
> platforms. When challenged, none have been able to provide hard numbers
> in support of their claim. To be fair, I know of no good source of
> numbers to disprove the claim, either. But the simple fact that anybody
> believes it is, in itself, evidence for the existence of a fairly large
> amount of embedded C programming going on.
>

There aren't many jobs for non-embedded C programmers. Virtually everyone
seems to specify C++ at least, and normally they are far more interested
in high level languages like Python or the various web, database, and
Windows only languages.
I think the reason is that the guts of a program, the central algorithm
that makes it work, is usually best written in C. So if the program is
essentially a Fourier transform, you'll write the FFT in C, if it's Huffman
compression you'll write the Huffman code in C, if it's a 2D image displayer,
all the code to draw triangles and rotate images will be written in C.
But most programmers don't work with the guts of a program. The work is in
hooking up code written by other people and integrating it and giving it user
interfaces. So C isn't particularly useful for that.
 
Reply With Quote
 
 
 
 
Tim Rentsch
Guest
Posts: n/a
 
      04-25-2013
David Brown <(E-Mail Removed)> writes:

> On 25/04/13 14:42, Johannes Bauer wrote:
>> On 25.04.2013 11:44, David Brown wrote:
>>
>>> "void main(void)" is preferable in most embedded systems - you want to
>>> explicitly say it has no arguments. Of course, it's a different matter
>>> if you intend to return from main or pass arguments to it, but in most
>>> small embedded systems main() never exits.

>>
>> "main" has a return parameter which is an int. Always.

>
> No, "main" does not always have a return parameter - "main"
> does not always return, and therefore a return parameter is
> meaningless. In most (small) embedded systems, main() never
> exits. Including a return parameter may mean wasted code, and
> will mean your compiler and/or static code checker will warn
> about unreachable code (if you include a return value) or
> missing return values (if you don't). [snip unrelated]


Both these problems can be avoided by writing main() this
way:

int
main( void ){

/* ... */
/* whatever main does in its loop body */
/* ... */

return main();
}

Of course I'm not completely serious, but neither is it
completely a joke. Presented with such a program, gcc
compiles it (under -O2) as a simple loop, not a call, and
with no generated return opcode or any other extra clutter.
 
Reply With Quote
 
Malcolm McLean
Guest
Posts: n/a
 
      04-25-2013
On Thursday, April 25, 2013 3:56:05 PM UTC+1, Dogukan Bayraktar wrote:
> 25 Nisan 2013 Perşembe 14:30:47 UTC+3 tarihinde David Brown yazdı:
>


>
> I'm from Turkey. So my native language is Turkish. But I want to learn English > so much
>
> I've been learning C for 5 months. But I want to improve my skills for C
> programming. I love C/C++ languages more than other languages like Java and
> C#.
>
>

Well keep on posting. The best way to learn English is to use it for real,
and you can kill two birds with one stone.
 
Reply With Quote
 
Dogukan Bayraktar
Guest
Posts: n/a
 
      04-25-2013
25 Nisan 2013 Perşembe 20:44:06 UTC+3 tarihinde James Kuyper yazdı:
> On 04/25/2013 10:56 AM, Dogukan Bayraktar wrote:
>
> > 25 Nisan 2013 Perşembe 14:30:47 UTC+3 tarihinde David Brown yazdı:

>
> >> On 24/04/13 21:30, Dogukan Bayraktar wrote:

>
> >>> Hi there!

>
> >>>

>
> >>> Firstly, sorry for my bad English :/

>
> >>>

>
> >>> I'm only 17 and I want to learn C and write perfect codes in C. I'm not so good in C programming, but I want to become a good C programmer.

>
> >>>

>
> >>> My English is not enough to read the programming articles or anything..

>
> >>> What should I do to become a good C programmer?

>
> >>

>
> >>> - Do you think is English needed for programming?

>
> ...
>
> >> Incidentally, what is your native language?

>
> ...
>
> > I'm from Turkey. So my native language is Turkish. But I want to learn English so much

>
>
>
> Try
>
> <https://groups.google.com/forum/?fromgroups#!forum/cprogramlama>. I
>
> can't read it, but Google claims it's a Turkish newsgroup, and the name
>
> sounds appropriate.



Thanks but that link is not useful for me because nobody didn't share anything about C programming on that link. Nothing to do with C programming. I don't want to write/listen/read/speak in Turkish, because of its that I want to improve my English. So I want to write/listen/read/speak in English toimprove it.

I have got a file of .PDF about C programming called "K&D C Programming".
In this e-book, i understand means of sentences. But I don't know too vocabulary. So I don't understand some sentences. I really want to read like that e-books.

* By the way, forgive me for my English :/
* I hope everyone understand me..

Thanks everyone for comments.
 
Reply With Quote
 
Dogukan Bayraktar
Guest
Posts: n/a
 
      04-25-2013
25 Nisan 2013 Perşembe 21:12:11 UTC+3 tarihinde Malcolm McLean yazdı:
> On Thursday, April 25, 2013 3:56:05 PM UTC+1, Dogukan Bayraktar wrote:
>
> > 25 Nisan 2013 Perşembe 14:30:47 UTC+3 tarihinde David Brown yazdı:

>
> >

>
>
>
> >

>
> > I'm from Turkey. So my native language is Turkish. But I want to learn English > so much

>
> >

>
> > I've been learning C for 5 months. But I want to improve my skills for C

>
> > programming. I love C/C++ languages more than other languages like Javaand

>
> > C#.

>
> >

>
> >

>
> Well keep on posting. The best way to learn English is to use it for real,
>
> and you can kill two birds with one stone.


Thank you for advice! I`ll keep on posting and reading!
 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      04-25-2013
On 04/25/2013 02:17 PM, Dogukan Bayraktar wrote:
> 25 Nisan 2013 Perşembe 20:44:06 UTC+3 tarihinde James Kuyper yazdı:

....
>> Try
>>
>> <https://groups.google.com/forum/?fromgroups#!forum/cprogramlama>. I
>>
>> can't read it, but Google claims it's a Turkish newsgroup, and the name
>>
>> sounds appropriate.

>
>
> Thanks but that link is not useful for me because nobody didn't share anything about C programming on that link. Nothing to do with C programming. ..


The group description translates to English as "Cprogramlama
This group is C, C + +, C #, Java, Php, such as languages ​​with C-like
syntax, and was established as a discussion and helping the environment.
General programming issues, algorithms, and other programming languages,
jobs and so on. correspondence related issues, too." That sounded
appropriate, I'm sorry that it wasn't.

> .. I don't want to write/listen/read/speak in Turkish, because of its that I want to improve my English. So I want to write/listen/read/speak in English to improve it.


That makes sense - but from my own experience with discussing technical
subjects in foreign languages, I think you should also have a fall-back
source of advice where you can use the language you understand best.

> I have got a file of .PDF about C programming called "K&D C Programming".


That should be "K&R", standing for "Kernighan and Ritchie", the authors.
 
Reply With Quote
 
Tim Rentsch
Guest
Posts: n/a
 
      04-25-2013
Dogukan Bayraktar <(E-Mail Removed)> writes:

> [snip]
>
> I have got a file of .PDF about C programming called "K&D C
> Programming".


> In this e-book, i understand means of sentences.


I expect you mean: you understand the _meaning_ of (some) sentences...

> But I don't know too vocabulary.


and that you don't know too _much_ vocabulary..

> So I don't understand some sentences. I really want to read like
> that e-books.


I think you mean you want to be able to read e-books like
the one you have. "I really want to be able to read other
e-books like that one." Is this what you meant, or did
you mean something else?

> * By the way, forgive me for my English :/
> * I hope everyone understand me..


I applaud your efforts, and your results. You're doing great!
("Applaud" is clapping hands, showing praise.)

> Thanks everyone for comments.


Two suggestions:

One: when you find a passage you don't understand, post it
here and ask about it. You should get an explanation that
will help both with understanding C and with learning English.

Two: if you are up to a challenge, get a copy of the official
defining document for C, such as

http://www.open-std.org/jtc1/sc22/wg...docs/n1256.pdf

This may be difficult for you, because it is more formal
English, but I think you'll be okay, and it has the advantage
that you can ask about it in the newsgroup here and lots of
people will be able to explain what it says. You will get
great practice for your English, and you will learn C much
more completely. (And if this document is too hard it is
always okay to go back to simpler stuff for a while.)

Good luck!
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      04-25-2013
On Thu, 2013-04-25, James Kuyper wrote:
....
> In this newsgroup I've talked with a number of people who thought that
> most, if not all, current C programming is being done for embedded
> platforms. When challenged, none have been able to provide hard numbers
> in support of their claim. To be fair, I know of no good source of
> numbers to disprove the claim, either. But the simple fact that anybody
> believes it is, in itself, evidence for the existence of a fairly large
> amount of embedded C programming going on.


There's also a lot of confusion about what "embedded programming" is.
My employers call what I do embedded programming, but it's really
for the most part ordinary Unix server programming.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Tim Rentsch
Guest
Posts: n/a
 
      04-25-2013
James Kuyper <(E-Mail Removed)> writes:

> On 04/25/2013 12:00 PM, David Brown wrote:
> ... [snip] ...
>
>> point 167 clearly says that "main" can be defined "in some other
>> implemention-defined manner".

>
> It can, but what 5.1.2.2.1 says is "It shall be defined with a
> return type of int and [details of one permitted form] or [details
> of a second permitted form] or equivalent; or in some other
> implementation-defined manner."
>
> It has been argued that "A and B or C or D; or E" should be parsed
> as "(A and B) or C or D; or E", but that doesn't make sense. The
> intended parse was "A and (B or C or D; or E)" (I'm not sure what
> affect the ';' should have on the parse).


That's wrong. The intended parse was ((A and (B or C)) or D) or E.
The footnote makes evident the wider applicability of D, and IIRC
Larry Jones has remarked in comp.std.c about case E being outside
all the previous conditions.

> If that weren't the case, A (== "it shall be defined with a return
> type of int") would be redundant, since the two explicitly specified
> forms already give a return type of 'int'. If that clause wasn't
> intended to apply to the "other implementation-defined manner", it
> could simply have been dropped.


That's a plausible line of reasoning, but certainly it is not the only
plausible line of reasoning. More importantly, it doesn't agree with
the views of many (or most?) other people who read the Standard,
and AFAIAA it does not agree with the views of the people who wrote
it.
 
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
silly question about Running a script from the command line A.Rock Python 0 04-10-2013 11:21 AM
newbie question about confusing exception handling in urllib cabbar@gmail.com Python 6 04-09-2013 07:11 PM
Need your advices =?utf-8?B?5rW36aOO?= Java 10 04-17-2006 10:26 PM
Need advices for exam 70-306 LoveGarfield MCSD 3 09-21-2003 11:06 AM
need advices : intranet archecture design Gildas Garcia ASP .Net 0 07-04-2003 07:08 PM



Advertisments