EmbDev.net

Forum: ARM programming with GCC/GNU tools Basic understanding of commands


Author: Stefan Ludwig (stefanl38)
Posted on:

Rate this post
0 useful
not useful
Hello,

im very new to ARM-GCC and c itself

so i have two very basic questions.
So "almost"-newbies have the pleasure to give an answer too.

what does the "~" do ?

example:

VICIntSelect &= ~0x00000040;

i was googling a lot but did not find anything at all
related to "c"

VICIntSelect is just a constant defined in the headerfile lpc2xxx.h

#define VICIntSelect   (*((volatile unsigned long *) 0xFFFFF00C))

das the commandline

VICIntSelect = 0x00000040;

mean: store value "0x00000040" in Memory-Adress "0xFFFFF00C" ?


thank you very much for helpful answers

greetings

Stefan

Author: Stefan (Guest)
Posted on:

Rate this post
0 useful
not useful
Stefan Ludwig wrote:
> what does the "~" do ?

~ (tilde) 1's complement

in German: "Komplementierung aller Bits eines Integer-Wertes
(NOT/Einer-Komplement)."

Examples:
~00000000 == 11111111
~11111111 == 00000000
~11001101 == 00110010

Links
http://www.schellong.de/c.htm#oper (German)
http://www.lysator.liu.se/c/bwk-tutor.html#bit

> VICIntSelect = 0x00000040;
> mean: store value "0x00000040" in Memory-Adress "0xFFFFF00C" ?

Yes.

Another Stefan ;-)

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Stefan Ludwig wrote:
> i was googling a lot but did not find anything at all
> related to "c"
What did you googler on? Obviously typing '~' into google would not get
you far! Googling of "C Operators" would have got you the answer - as
would any good C reference (in fact even a bad reference!). Get yourself
a copy of K&R for example.

Clifford

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Clifford Slocombe wrote:
> Stefan Ludwig wrote:
>> i was googling a lot but did not find anything at all
>> related to "c"
> What did you googler on? Obviously typing '~' into google would not get
> you far! Googling of "C Operators" would have got you the answer - as
> would any good C reference (in fact even a bad reference!). Get yourself
> a copy of K&R for example.
>
> Clifford

Just for the record, this is the response this ilicited from Stefan by
privaed e-mail:

====================================
so you're just another one of this arrogant guys
throwing around special TLA*s like "K&R"

What if I even did not know that "~" is an OPERATOR?

judging about your answer: NOT HELPFUL AT ALL
just satisfying your frustration about what ever
====================================

I am sorry Stephan, if you found the response unhelpful. That was not
the intention. I felt that the specific question had been adequately
answered, so rather than duplicate the information I thought that
perhaps a better approach to problem solving than posting to a forum
might be helpful. Also the suggestion would have provided information on
all the other C operators as well. It is interesting that you found that
unhelpful.

It did not seem unreasonable to me that if you are going to use a
programming language that you should have some sort of language
reference. "The C Programming Language" by Kernighan and Ritchie (K&R)
is the seminal work on the language. It commonly referred to as K&R, and
Google'ing on just that will certainly tell you what it is if you were
not familiar.

If you did not realise that '~' was an operator, than you don't really
understand the syntax of C. All the more reason to get a reference.

Author: FordP (Guest)
Posted on:

Rate this post
0 useful
not useful
Another suggestion if you find a search engine does not work for you, is
to head over to wikipedia which will always lead to a starting point to
find out about such things.

Good Luck with learning ANSI C, I have been using it for 18 years so I
think I have the hang of it now!

Author: FordP (Guest)
Posted on:

Rate this post
0 useful
not useful
I took some of my own medcine and found this :-

http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

Not bad for 5 clicks!


FordP wrote:
> Another suggestion if you find a search engine does not work for you, is
> to head over to wikipedia which will always lead to a starting point to
> find out about such things.
>
> Good Luck with learning ANSI C, I have been using it for 18 years so I
> think I have the hang of it now!

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.