Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion szukam kogos, kto napisze program w c
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stachu 'Dozzie' K.  
View profile   Translate to Translated (View Original)
 More options Jan 17 2006, 6:16 pm
Newsgroups: pl.comp.os.linux.programowanie
From: "Stachu 'Dozzie' K." <doz...@dynamit.im.pwr.wroc.pl.nospam>
Date: Tue, 17 Jan 2006 23:16:56 +0000 (UTC)
Local: Tues, Jan 17 2006 6:16 pm
Subject: Re: szukam kogos, kto napisze program w c
On 17.01.2006, Kajetan Staszkiewicz <vegetanos...@tuxpowered.net> wrote:

> Dnia wtorek, 17 stycznia 2006 23:39, Stachu 'Dozzie' K. napisał(a):

>> int main = 12828721;

> skąd akurat taka wartość?

Z assemblera. Żeby ładnie się zero znalazło w EAX, a potem żeby ładnie
się RET wykonało.

#v+
[dozzie@hans dozzie]$ perl -e 'print pack "I", 12828721' > asmcode.bin
[dozzie@hans dozzie]$ ndisasm -b 32 asmcode.bin
00000000  31C0              xor eax,eax
00000002  C3                ret
00000003  00                db 0x00
[dozzie@hans dozzie]$
#v-

main zwykle jest funkcją, zatem pod symbolem "main" znajduje się
początek kodu, który należy wykonać. Dla linkera to tylko etykieta dla
jakiegoś adresu (dla jakiejś liczby). Podobnie jest z "int main;": dla
linkera to dalej jest etykieta dla jakiegoś adresu w pamięci, tyle że
tym razem pod tym adresem znajdują się dane innego typu (tutaj: int).
Jeśli wpisałbym tam cokolwiek, to to cokolwiek zaczęłoby się wykonywać
jako kod maszynowy, więc wpakowałem tam nawet całkiem sensowny kod.

--
Feel free to correct my English
Stanislaw Klekot


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.