[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] pointer gymnastik



At 18:38 11-09-99 +0200, you wrote:
>Kim Pedersen <sslug@sslug> skrev:
>
>> >En streng incrementerer lineært? *p++ har anden sideeffekt på p end
>> >p++ har?
>
>>  *p og p er jo overhovedet ikke det samme. Hvad der er ment er at en
>> compiler måske siger at
>>  hele strengen skal lagres lige efter hinanden ( hver karakter ), mens en
>> anden måske lægger karakterene på 10 forskellige adresser hvorved den
>> eneste måde at incrementere på via en pointer for at få det rigtige
>> resultat vil være: p++.
>
>p++ forøger p og returnerer den værdi, den havde før
 korrekt.
>
>*p++ forøger p og returnerer det, den pegede på
 forkert, *p++ forøger ikke p, men prøver at forøge det p peger på, men som
er den næste karakter.
>
>Da vi ikke bruger returværdien er deres virkning altså ens. Så kan jeg
>ikke se, hvorledes hukommelsesopbygningen har noget at sige. Og jeg
>tvivler i øvrigt på, at det er lovligt for en compiler at lægge et
>array ud som det vil.
 fuldt ud lovligt, kommer jo simpelthen an på hvad for en computer
compileren er skrevet til ( det er jo derfor java er så revolutionerende,
den bruger en standard datatype istedet for de mange forskellige, og derved
kan de også lave en meget bedre semantik )..

  Med Venlig Hilsen
  Kim Pedersen
>-- 
>Regards, Anders                         If a Microsoft product
>(address is valid)                      fails, who do you sue?
>



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *