Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
August 06, 2003 access violation | ||||
---|---|---|---|---|
| ||||
why im getting an access violation in a call to a member function???... what are the posible reasons?? greetings vicentico |
August 06, 2003 Re: access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to vicentico | Just one... accessing of memory that your app doesn't own. ;) Perhaps an example of what you're trying to do and what you've tried to do to figure it out would help us to help you better. Sean "vicentico" <vicentico_member@pathlink.com> wrote in message news:bgra10$12js$1@digitaldaemon.com... > why im getting an access violation in a call to a member function???... what are > the posible reasons?? > > greetings > > vicentico |
August 06, 2003 Re: access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | this is the call:
TableItem* result = table.search(ws, index-ws);
table.search is a public method, ws is a char* that points to a global char array in the main module. index is another char* that points to a position in the same char array. TableItem is a struct declared in another module.
table is declared in the main module, it doesnt have a constructor. i assume that the error is in the function call because table.search prints a string before executing any code, and the code before the call has been tested too.
i hope that i had been doing something wrong and that this is not another bug in the compiler...
vicentico
>
>Just one... accessing of memory that your app doesn't own. ;)
>
>Perhaps an example of what you're trying to do and what you've tried to do to figure it out would help us to help you better.
>
>Sean
>
>"vicentico" <vicentico_member@pathlink.com> wrote in message news:bgra10$12js$1@digitaldaemon.com...
>> why im getting an access violation in a call to a member function???...
>what are
>> the posible reasons??
>>
>> greetings
>>
>> vicentico
>
>
|
August 06, 2003 Re: access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to vicentico | "vicentico" <vicentico_member@pathlink.com> wrote in message news:bgrctv$15qs$1@digitaldaemon.com... | this is the call: | | TableItem* result = table.search(ws, index-ws); | | table.search is a public method, ws is a char* that points to a global char | array in the main module. index is another char* that points to a position in | the same char array. TableItem is a struct declared in another module. | | table is declared in the main module, it doesnt have a constructor. i assume | that the error is in the function call because table.search prints a string | before executing any code, and the code before the call has been tested too. | | i hope that i had been doing something wrong and that this is not another bug in | the compiler... | | | vicentico Make sure you're "newing" table: table=new whatever(...); ————————————————————————— Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 2003-08-04 |
August 06, 2003 Re: access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | In article <bgrji9$1cb9$1@digitaldaemon.com>, Carlos Santander B. says... > >"vicentico" <vicentico_member@pathlink.com> wrote in message >news:bgrctv$15qs$1@digitaldaemon.com... >| this is the call: >| >| TableItem* result = table.search(ws, index-ws); >| >| table.search is a public method, ws is a char* that points to a global >char >| array in the main module. index is another char* that points to a position >in >| the same char array. TableItem is a struct declared in another module. >| >| table is declared in the main module, it doesnt have a constructor. i >assume >| that the error is in the function call because table.search prints a >string >| before executing any code, and the code before the call has been tested >too. >| >| i hope that i had been doing something wrong and that this is not another >bug in >| the compiler... >| >| >| vicentico > >Make sure you're "newing" table: table=new whatever(...); > the class has no constructor and when i try to do the "newing" i get a compiler error. Even if I define a blank constructor the error is still there. >————————————————————————— Carlos Santander |
August 07, 2003 Re: access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to vicentico | "vicentico" <vicentico_member@pathlink.com> wrote in message news:bgrr1o$1jmo$1@digitaldaemon.com... | the class has no constructor and when i try to do the "newing" i get a compiler | error. Even if I define a blank constructor the error is still there. | The compiler error has nothing to do with the class having no constructor. For example, the following compiles just fine: class X {} void main() { X x=new X(); } I'm guessing your problem is around there because I've had that too :), and very often some persons ask about almost the same. ————————————————————————— Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 2003-08-04 |
August 07, 2003 Re: access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | In article <bgsfso$2666$1@digitaldaemon.com>, Carlos Santander B. says... > >The compiler error has nothing to do with the class having no constructor. For example, the following compiles just fine: > >class X {} >void main() { X x=new X(); } > i get this error if i try to initialize to the default constructor Application application = new Application(); C:\DMD\IMP\X\APPLIC~1.D(61): non-constant expression new Application >I'm guessing your problem is around there because I've had that too :), and very often some persons ask about almost the same. > >————————————————————————— Carlos Santander > > >--- >Outgoing mail is certified Virus Free. >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.507 / Virus Database: 304 - Release Date: 2003-08-04 > > |
August 07, 2003 Re: access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to vicentico | "vicentico" <vicentico_member@pathlink.com> wrote in message news:bgtq4e$e86$1@digitaldaemon.com... > In article <bgsfso$2666$1@digitaldaemon.com>, Carlos Santander B. says... > > > >The compiler error has nothing to do with the class having no constructor. > >For example, the following compiles just fine: > > > >class X {} > >void main() { X x=new X(); } > > > i get this error if i try to initialize to the default constructor > > Application application = new Application(); > C:\DMD\IMP\X\APPLIC~1.D(61): non-constant expression new Application > > > >I'm guessing your problem is around there because I've had that too :), and > >very often some persons ask about almost the same. > > > >------------------------- > >Carlos Santander > > > > > >--- > >Outgoing mail is certified Virus Free. > >Checked by AVG anti-virus system (http://www.grisoft.com). > >Version: 6.0.507 / Virus Database: 304 - Release Date: 2003-08-04 > > > > > If it's static or global you'll have to put the assignment in a static constructor: Application application; static this() { application = new Application(); } |
August 07, 2003 Re: access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | This is BS, Walter. Please allow static initialization of arrays, structs, object references, and effectively move the code from global scope into the start of the static constructor. D would be easy to use, *except* that you have all these restrictions that cause us to have to do things the non-intuitive way, apparently in the name of readability or keeping the compiler implementation simple. I believe everyone's gut instinct is to put initializations at the point of declaration. It's easier to maintain if they're kept together, as well. Sean "Vathix" <vathix@dprogramming.com> wrote in message news:bgtvg9$jgu$1@digitaldaemon.com... > If it's static or global you'll have to put the assignment in a static constructor: > > Application application; > static this() > { > application = new Application(); > } |
Copyright © 1999-2021 by the D Language Foundation