English
C ++ Forum

Zeiger

 
- Page 1 -


Hello, somehow pack I it with the Zeiger not of C++(Dev C++).
it comes here the worth 0 out, really wished I 45 having.

who knows itself there from with the Error, whom I with the Zeiger made have?

mfg
peter
CompileMarkSeparation
declare testram#
dim testram#,100
cls
test()
print byte(testram#,0)
WaitInput
end

proc test

    parameters testram#
    int *a;
    *a=addr(testram#);
    a[0]=45;

09/13/08  
 



 
- Page 2 -



Jörg
Sellmeyer
Mach time print ram#
Perhaps is the already the sought Zeiger.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
09/13/08  
 




Sebastian
König
I have it now not tested, but

long *pL = (long*)PVAR(ram#);

ought to really functions...

Nachtrag: Jörgs Info goes into same direction, see I straight
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
09/13/08  
 



thanks you, now goes it.
Print ram#, there comes the Zeiger directly , without the commands : addr.

this is the C++-commands : char* p = reinterpret_cast<char*>(adrr);

to that Test have I The address 44 and 45 outputted.
it'll the right worth from the address 44 and 45 outputted.
both Zeiger catch with "0" on.

Puhhh......

mfg
peter
CompileMarkSeparation
declare adresse%,ram#
dim ram#,1000
adresse%=ram#
cls
hole()
print byte(ram#,44)
print byte(ram#,45)
WaitInput
end

proc hole

    P2CPP: <INLINE_CPP>
    long adrr;
    adrr=PVAR(adresse%);
    char* p = reinterpret_cast<char*>(adrr);
    p[44]=66;
    p[45]=77;
    P2CPP: </INLINE_CPP>

endproc

 
09/13/08  
 



and another For-Loop in C++.
Hui, The goes ex, 10x 10.000.000.

can I hardly believe, confirm the please times.
I have 180ms.
Sebastian kannste The time testing, not the The Variable with 10.000.000 wrong go through becomes.

mfg
peter
CompileMarkSeparation
 
09/13/08  
 



long *pL = (long*)PVAR(ram#);

The commands is not .

mfg
peter
 
09/13/08  
 



sure the You do not long pL = (long*)PVAR(ram#) mean? Have no prf2cpp to hand...
 
09/13/08  
 



Have no prf2cpp to hand...

becomes but Time, the it with you standard becomes these Wunderwaffe ala C++ with Profan2ccp.

mfg
peter
 
09/13/08  
 



long pL = (long*)PVAR(ram#)

Compilerfehler..

Nimm these Variante : char* pL = reinterpret_cast<char*>( adrr);

mfg
peter
 
09/13/08  
 




Sebastian
König
Peter Bierbachh
long pL = (long*)PVAR(ram#)

Compilerfehler..

Nimm these Variante : char* pL = reinterpret_cast<char*>( adrr);


OK, the reinterpret_cast<>() is in the doing The secure Variante, since the Memory-Variables in the of Profan2Cpp begot code first of all time no Zeigertyp (but in Grunde simply long) are. some Compiler meckern then whom middle-aged C-Style Cast with (long*) on.

your code looks really from . naturally runs the then very quick. for such things is Inline-C++ though not at all necessary, the the XProfan-code indeed to C++ Translated becomes. You can to that example time this here testing:
CompileMarkSeparation
declare test%,i%
cls
test%=&GetTickCount

whileloop 1,10,1

    schleife_prf()
    print i%

endwhile

proc schleife_prf

    var zahl% = 0

    whileloop 10000000

        zahl% = zahl% + 1

    endwhile

endproc

Print Str$(Int(&GetTickCount-test%))
WaitInput
end

If I The Compiler-Optimierungen (with the TuneMake-Plug-In  [...]  ) deaktiviere, can I none Geschwindigkeitsunterschied To your Variante with the Inline-code More check.

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
09/14/08  
 



OK, the reinterpret_cast<>() is in the doing The secure Variante,

can you for once more a substitute reinstellen, whom then any Compiler receive?

mfg
peter
 
09/14/08  
 



here see it differently from.
installed in the program as C++ and then with Profan2cpp : 143ms Dev C++ and 135ms with BCC55
as normales Program with Profan2cpp prepares : 670ms with DEV c++ and 390ms with BCC55

mfg
peter
CompileMarkSeparation
cls
declare bildxy#,laenge%,test%,z%
dim bildxy#,65000
laenge%=65000
test%=&GetTickCount

whileloop 1,100,1

    z%=rgb_farbe_cpp(bildxy#,laenge%)

endwhile

Print Str$(Int(&GetTickCount-test%))
WaitInput
end

proc rgb_farbe_cpp

    parameters bildxy#,laenge%
    declare r%,g%,b%

    whileloop 0,laenge%-1,4

        b%=byte(bildxy#,&loop)
        g%=byte(bildxy#,&loop+1)
        r%=byte(bildxy#,&loop+2)

        if (b%>252) | (g%>252) | (r%>252)

            z%=255
            break

        endif

    endwhile

ENDPROC

 
09/14/08  
 




Sebastian
König
Peter Bierbachh
OK, the reinterpret_cast<>() is in the doing The secure Variante,

can you for once more a substitute reinstellen, whom then any Compiler receive?


The reinterpret_cast<>() ought to really of all Compilern recognized go - he's part the standard-C++ Sprachumfangs.... What exactly functions because not? generally counts, that one itself with Inline-C++ integrally simply on the hold must, what the used Compiler supported. I can only at Übersetzen the XProfan-Codes ensuring, that the Result with all supported Compilern runs.

Peter Bierbach
here see it differently from.
installed in the program as C++ and then with Profan2cpp : 143ms Dev C++ and 135ms with BCC55
as normales Program with Profan2cpp prepares : 670ms with DEV c++ and 390ms with BCC55


OK, then comes it well on whom individual case on. Inline-C++ is naturally useful for very geschwindigkeitskritische items - like Inline-ASM in C++. latter went incidentally too inside the INLINE_CPP-Blocks, but I work to Time too at a direct Support of Franks XPIA in Profan2Cpp .

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
09/14/08  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

8.632 Views

Untitledvor 0 min.
funkheld12/17/13
H.Hackl03/22/12

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie