public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: G++/times causes access violation on cygwin, not linux
@ 2000-08-24 13:00 Mirko Vukovic
  2000-08-25  0:33 ` Bjoern Kahl AG Resy
  0 siblings, 1 reply; 10+ messages in thread
From: Mirko Vukovic @ 2000-08-24 13:00 UTC (permalink / raw)
  To: cygwin forum, Robinow, David

Thank you all,

what a (nevermind) mistake that was.  At least I was correct in one thing.  It was not a g++ bug.

thanks again
--

On Thu, 24 Aug 2000 15:55:14   Robinow, David wrote:
> Try
> struct tms * pArg = new struct tms;
>
>pArg has to point to someting!
>
>-----Original Message-----
>From: Mirko Vukovic [ mailto:mvukovic@my-Deja.com ]
>Sent: Thursday, August 24, 2000 3:38 PM
>To: cygwin forum
>Cc: Earnie Boyd
>Subject: Re: G++/times causes access violation on cygwin, not linux
>
>
>I downloaded the latest cygwin (instal.exe worked no problem) and got same
>message under 2.92.2.  To repeat, it compiled and ran without a problem
>under linux and egcs 2.91.66.
>
>(I include the code below again for reference)
>
>Mirko
>
># include <sys/times.h>
># include <iostream.h>
>int main()
>{
>  clock_t ElapsedSystemTime;
>  struct tms * pArg;
>  ElapsedSystemTime=times(pArg);
>  cout << ElapsedSystemTime <<"\n";
>  cout << pArg->tms_utime<<"\n";
>  cout << pArg->tms_stime<<"\n";
>  cout << pArg->tms_cutime<<"\n";
>  cout << pArg->tms_cstime<<"\n";
>  return 0;
>}
>--
>
>On Thu, 24 Aug 2000 09:15:12   Earnie Boyd wrote:
>>--- Mirko Vukovic <mvukovic@my-Deja.com> wrote:
>>> The code that follows in the included message compiles cleanly under both
>>> cygwin (egcs 2.91.57) and linux (egcs 2.91.66), but runs only under
>linux.  
>>> 
>>> Passing a proper variable to times() instead of NULL (pointer to a "tms"
>>> structure), does not improve things.
>>> 
>>> I still bet it is not a bug, but what is the problem then?
>>> 
>>
>>Your compiler is too old.  You need `gcc --version' == "2.95.2" to make it
>>work.  Oh, you still need the pointer to a tms structure in time().
>>
>>Cheers,
>>
>>
>>=====
>>---
>>   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
>>            __Cygwin: POSIX on Windows__
>>Cygwin Newbies: < http://gw32.freeyellow.com/ >
>>           __Minimalist GNU for Windows__
>>  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
>>    Mingw Home: < http://www.mingw.org/ >
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Yahoo! Mail - Free email you can access from anywhere!
>> http://mail.yahoo.com/
>>
>
>
>--== Sent via Deja.com http://www.deja.com/ ==--
>Before you buy.
>
>--
>Want to unsubscribe from this list?
>Send a message to cygwin-unsubscribe@sourceware.cygnus.com
>


--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: G++/times causes access violation on cygwin, not linux
  2000-08-24 13:00 G++/times causes access violation on cygwin, not linux Mirko Vukovic
@ 2000-08-25  0:33 ` Bjoern Kahl AG Resy
  0 siblings, 0 replies; 10+ messages in thread
From: Bjoern Kahl AG Resy @ 2000-08-25  0:33 UTC (permalink / raw)
  To: Mirko Vukovic; +Cc: cygwin forum

On Thu, 24 Aug 2000, Mirko Vukovic wrote:

> Thank you all,
> 
> what a (nevermind) mistake that was.  At least I was correct in one thing.  It was not a g++ bug.

 Hallo!

 May be, you are confusing time() and times() ?
                              ^^         ^^^

 time(0) is ok, times(0) not.
                   ^^^ 

 Greetings

 Bjoern

-- 
+---------------------------------------------------------------------+
| Dipl.-Phys. Bjoern Kahl +++ AG Embedded Systems and Robotics (RESY) |
| Informatics Faculty +++ Building 48 +++ University of Kaiserslautern|
| phone: +49-631-205-2654 +++ www: http://resy.informatik.uni-kl.de   |
+---------------------------------------------------------------------+



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: G++/times causes access violation on cygwin, not linux
  2000-08-24 12:27 Mirko Vukovic
  2000-08-24 12:39 ` DJ Delorie
@ 2000-08-24 12:59 ` Benjamin Riefenstahl
  1 sibling, 0 replies; 10+ messages in thread
From: Benjamin Riefenstahl @ 2000-08-24 12:59 UTC (permalink / raw)
  To: cygwin forum

Hi Mirko,


Mirko Vukovic wrote:
>   clock_t ElapsedSystemTime;
>   struct tms * pArg;
>   ElapsedSystemTime=times(pArg);

You're not allocating memory for the struct tms anywhere.  As it stands
you are passing an uninitialized garbage pointer to times().  I didn't
look up times() in the manual, but this should probably say

    struct tms arg;
    ElapsedSystemTime=times(&arg);

Note that I declared "arg" as a value of type struct tms, not as a
pointer.  It's also possible that you need to initialize that value,
consult the documentation of times() for that issue.


so long, benny
-- 
ISION Internet AG
Benjamin Riefenstahl
mailto:benjamin.riefenstahl@ision.net

Ruhrstrasse 61
D-22761 Hamburg
http://www.ision.net

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: G++/times causes access violation on cygwin, not linux
@ 2000-08-24 12:52 Robinow, David
  0 siblings, 0 replies; 10+ messages in thread
From: Robinow, David @ 2000-08-24 12:52 UTC (permalink / raw)
  To: 'mvukovic@my-Deja.com', cygwin forum; +Cc: Earnie Boyd

 Try
 struct tms * pArg = new struct tms;

pArg has to point to someting!

-----Original Message-----
From: Mirko Vukovic [ mailto:mvukovic@my-Deja.com ]
Sent: Thursday, August 24, 2000 3:38 PM
To: cygwin forum
Cc: Earnie Boyd
Subject: Re: G++/times causes access violation on cygwin, not linux


I downloaded the latest cygwin (instal.exe worked no problem) and got same
message under 2.92.2.  To repeat, it compiled and ran without a problem
under linux and egcs 2.91.66.

(I include the code below again for reference)

Mirko

# include <sys/times.h>
# include <iostream.h>
int main()
{
  clock_t ElapsedSystemTime;
  struct tms * pArg;
  ElapsedSystemTime=times(pArg);
  cout << ElapsedSystemTime <<"\n";
  cout << pArg->tms_utime<<"\n";
  cout << pArg->tms_stime<<"\n";
  cout << pArg->tms_cutime<<"\n";
  cout << pArg->tms_cstime<<"\n";
  return 0;
}
--

On Thu, 24 Aug 2000 09:15:12   Earnie Boyd wrote:
>--- Mirko Vukovic <mvukovic@my-Deja.com> wrote:
>> The code that follows in the included message compiles cleanly under both
>> cygwin (egcs 2.91.57) and linux (egcs 2.91.66), but runs only under
linux.  
>> 
>> Passing a proper variable to times() instead of NULL (pointer to a "tms"
>> structure), does not improve things.
>> 
>> I still bet it is not a bug, but what is the problem then?
>> 
>
>Your compiler is too old.  You need `gcc --version' == "2.95.2" to make it
>work.  Oh, you still need the pointer to a tms structure in time().
>
>Cheers,
>
>
>=====
>---
>   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
>            __Cygwin: POSIX on Windows__
>Cygwin Newbies: < http://gw32.freeyellow.com/ >
>           __Minimalist GNU for Windows__
>  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
>    Mingw Home: < http://www.mingw.org/ >
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>


--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: G++/times causes access violation on cygwin, not linux
  2000-08-24 12:27 Mirko Vukovic
@ 2000-08-24 12:39 ` DJ Delorie
  2000-08-24 12:59 ` Benjamin Riefenstahl
  1 sibling, 0 replies; 10+ messages in thread
From: DJ Delorie @ 2000-08-24 12:39 UTC (permalink / raw)
  To: mvukovic; +Cc: cygwin

>   struct tms * pArg;
>   ElapsedSystemTime=times(pArg);

Ok, you passed the function a pointer.  Where does the pointer point to?

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: G++/times causes access violation on cygwin, not linux
@ 2000-08-24 12:38 Mirko Vukovic
  0 siblings, 0 replies; 10+ messages in thread
From: Mirko Vukovic @ 2000-08-24 12:38 UTC (permalink / raw)
  To: cygwin forum; +Cc: Earnie Boyd

I downloaded the latest cygwin (instal.exe worked no problem) and got same message under 2.92.2.  To repeat, it compiled and ran without a problem under linux and egcs 2.91.66.

(I include the code below again for reference)

Mirko

# include <sys/times.h>
# include <iostream.h>
int main()
{
  clock_t ElapsedSystemTime;
  struct tms * pArg;
  ElapsedSystemTime=times(pArg);
  cout << ElapsedSystemTime <<"\n";
  cout << pArg->tms_utime<<"\n";
  cout << pArg->tms_stime<<"\n";
  cout << pArg->tms_cutime<<"\n";
  cout << pArg->tms_cstime<<"\n";
  return 0;
}
--

On Thu, 24 Aug 2000 09:15:12   Earnie Boyd wrote:
>--- Mirko Vukovic <mvukovic@my-Deja.com> wrote:
>> The code that follows in the included message compiles cleanly under both
>> cygwin (egcs 2.91.57) and linux (egcs 2.91.66), but runs only under linux.  
>> 
>> Passing a proper variable to times() instead of NULL (pointer to a "tms"
>> structure), does not improve things.
>> 
>> I still bet it is not a bug, but what is the problem then?
>> 
>
>Your compiler is too old.  You need `gcc --version' == "2.95.2" to make it
>work.  Oh, you still need the pointer to a tms structure in time().
>
>Cheers,
>
>
>=====
>---
>   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
>            __Cygwin: POSIX on Windows__
>Cygwin Newbies: < http://gw32.freeyellow.com/ >
>           __Minimalist GNU for Windows__
>  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
>    Mingw Home: < http://www.mingw.org/ >
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>


--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: G++/times causes access violation on cygwin, not linux
@ 2000-08-24 12:33 Earnie Boyd
  0 siblings, 0 replies; 10+ messages in thread
From: Earnie Boyd @ 2000-08-24 12:33 UTC (permalink / raw)
  To: mvukovic, cygwin forum

As I said, it worked for me.  It must be time to bring out the debugger gdb.

Earnie.
--- Mirko Vukovic <mvukovic@my-Deja.com> wrote:
> I downloaded the latest cygwin (instal.exe worked no problem) and got same
> message under 2.92.2.  To repeat, it compiled and ran without a problem under
> linux and egcs 2.91.66.
> 
> (I include the code below again for reference)
> 
> Mirko
> 
> # include <sys/times.h>
> # include <iostream.h>
> int main()
> {
>   clock_t ElapsedSystemTime;
>   struct tms * pArg;
>   ElapsedSystemTime=times(pArg);
>   cout << ElapsedSystemTime <<"\n";
>   cout << pArg->tms_utime<<"\n";
>   cout << pArg->tms_stime<<"\n";
>   cout << pArg->tms_cutime<<"\n";
>   cout << pArg->tms_cstime<<"\n";
>   return 0;
> }
> --
> 
> On Thu, 24 Aug 2000 09:15:12   Earnie Boyd wrote:
> >--- Mirko Vukovic <mvukovic@my-Deja.com> wrote:
> >> The code that follows in the included message compiles cleanly under both
> >> cygwin (egcs 2.91.57) and linux (egcs 2.91.66), but runs only under linux.
>  
> >> 
> >> Passing a proper variable to times() instead of NULL (pointer to a "tms"
> >> structure), does not improve things.
> >> 
> >> I still bet it is not a bug, but what is the problem then?
> >> 
> >
> >Your compiler is too old.  You need `gcc --version' == "2.95.2" to make it
> >work.  Oh, you still need the pointer to a tms structure in time().
> >
> >Cheers,
> >
> >
> >=====
> >---
> >   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
> >            __Cygwin: POSIX on Windows__
> >Cygwin Newbies: < http://gw32.freeyellow.com/ >
> >           __Minimalist GNU for Windows__
> >  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
> >    Mingw Home: < http://www.mingw.org/ >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! Mail - Free email you can access from anywhere!
> > http://mail.yahoo.com/
> >
> 
> 
> --== Sent via Deja.com http://www.deja.com/ ==--
> Before you buy.


__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: G++/times causes access violation on cygwin, not linux
@ 2000-08-24 12:27 Mirko Vukovic
  2000-08-24 12:39 ` DJ Delorie
  2000-08-24 12:59 ` Benjamin Riefenstahl
  0 siblings, 2 replies; 10+ messages in thread
From: Mirko Vukovic @ 2000-08-24 12:27 UTC (permalink / raw)
  To: cygwin forum; +Cc: Earnie Boyd

I downloaded the latest cygwin (instal.exe worked no problem) and got same message under 2.92.2.  To repeat, it compiled and ran without a problem under linux and egcs 2.91.66.

(I include the code below again for reference)

Mirko

# include <sys/times.h>
# include <iostream.h>
int main()
{
  clock_t ElapsedSystemTime;
  struct tms * pArg;
  ElapsedSystemTime=times(pArg);
  cout << ElapsedSystemTime <<"\n";
  cout << pArg->tms_utime<<"\n";
  cout << pArg->tms_stime<<"\n";
  cout << pArg->tms_cutime<<"\n";
  cout << pArg->tms_cstime<<"\n";
  return 0;
}
--

On Thu, 24 Aug 2000 09:15:12   Earnie Boyd wrote:
>--- Mirko Vukovic <mvukovic@my-Deja.com> wrote:
>> The code that follows in the included message compiles cleanly under both
>> cygwin (egcs 2.91.57) and linux (egcs 2.91.66), but runs only under linux.  
>> 
>> Passing a proper variable to times() instead of NULL (pointer to a "tms"
>> structure), does not improve things.
>> 
>> I still bet it is not a bug, but what is the problem then?
>> 
>
>Your compiler is too old.  You need `gcc --version' == "2.95.2" to make it
>work.  Oh, you still need the pointer to a tms structure in time().
>
>Cheers,
>
>
>=====
>---
>   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
>            __Cygwin: POSIX on Windows__
>Cygwin Newbies: < http://gw32.freeyellow.com/ >
>           __Minimalist GNU for Windows__
>  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
>    Mingw Home: < http://www.mingw.org/ >
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>


--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: G++/times causes access violation on cygwin, not linux
@ 2000-08-24  9:15 Earnie Boyd
  0 siblings, 0 replies; 10+ messages in thread
From: Earnie Boyd @ 2000-08-24  9:15 UTC (permalink / raw)
  To: mvukovic, cygwin forum

--- Mirko Vukovic <mvukovic@my-Deja.com> wrote:
> The code that follows in the included message compiles cleanly under both
> cygwin (egcs 2.91.57) and linux (egcs 2.91.66), but runs only under linux.  
> 
> Passing a proper variable to times() instead of NULL (pointer to a "tms"
> structure), does not improve things.
> 
> I still bet it is not a bug, but what is the problem then?
> 

Your compiler is too old.  You need `gcc --version' == "2.95.2" to make it
work.  Oh, you still need the pointer to a tms structure in time().

Cheers,


=====
---
   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
            __Cygwin: POSIX on Windows__
Cygwin Newbies: < http://gw32.freeyellow.com/ >
           __Minimalist GNU for Windows__
  Mingw32 List: < http://www.egroups.com/group/mingw32/ >
    Mingw Home: < http://www.mingw.org/ >

__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* G++/times causes access violation on cygwin, not linux
@ 2000-08-24  8:44 Mirko Vukovic
  0 siblings, 0 replies; 10+ messages in thread
From: Mirko Vukovic @ 2000-08-24  8:44 UTC (permalink / raw)
  To: cygwin forum

The code that follows in the included message compiles cleanly under both cygwin (egcs 2.91.57) and linux (egcs 2.91.66), but runs only under linux.  

Passing a proper variable to times() instead of NULL (pointer to a "tms" structure), does not improve things.

I still bet it is not a bug, but what is the problem then?

Mirko
> 
> When the following code
> 
> # include <sys/times.h>
> # include <iostream.h>
> int main()
> {
>   clock_t ElapsedSystemTime;
>   ElapsedSystemTime=times(NULL);
>   cout << ElapsedSystemTime <<"/n";
>   return 0;
> }
> 
> is run, I get an access violation.  I adapted this from Tom Swan's (sp?)
> G++ on Linux book.  



--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2000-08-25  0:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-24 13:00 G++/times causes access violation on cygwin, not linux Mirko Vukovic
2000-08-25  0:33 ` Bjoern Kahl AG Resy
  -- strict thread matches above, loose matches on Subject: below --
2000-08-24 12:52 Robinow, David
2000-08-24 12:38 Mirko Vukovic
2000-08-24 12:33 Earnie Boyd
2000-08-24 12:27 Mirko Vukovic
2000-08-24 12:39 ` DJ Delorie
2000-08-24 12:59 ` Benjamin Riefenstahl
2000-08-24  9:15 Earnie Boyd
2000-08-24  8:44 Mirko Vukovic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).