Unaligned access error

1999-04-11 Thread Dan Jue


This message is output to the screen after my void function ends and
before main regains control.

Unaligned access pid=22768 p5.x va=0x11a1a pc=0x3ff80199120
ra=0x3ff800d4544 inst=0xa622fff8

Can anyone clue me in on what is going on in general?  
(ie layman's terms for Unaligned Access)
I'm using classes with 'g++ -Wall' in my makefile for all. 
p5.x is my executable.

I also get a nice little segmentation fault after a couple iterations of
this (each with slightly different hex addresses).

Thank you

Best Regards,

*   Dan Jue, CMSC UMCP  *Linux '99   *
*   * We Will Add Your Uniqueness To Our Own *

 




Re: array filling problem

1999-04-10 Thread Dan Jue


  
  int main ()
  { const dim = 5;
   float a[dim-1][dim-1];
 
 The above creates a matrix of [4][4]; that is, each dimension varies from
 [0] to [3]. a[0][3] is the last element of the first row; a[0][4] is
 infact the first element of the second row which is better represented by
 a[1][0]. 

Are we allowed to assume that row-major order arrays are totally 
contiguous in memory for any platform (by your example of address
a[0][4])?  For arrays of structures or objects (or some other big unit),
is it not possible for their locations in memory to be non-contiguous?

Also i'm assuming that you cannot access a[0][4] directly because wouldn't
that cause an out-of-bound subscript error?  So you would instead do some
manual pointer arithmetic to get that address, right?

Thanx for any response.


Best Regards,


*   Dan Jue, CMSC UMCP   *Linux '99  *
**   ReSiTaNcE iS FuTiLe!*





RE: prompt when 25 lines..

1998-09-19 Thread Dan Jue

On Sat, 19 Sep 1998, subbaraom wrote:
 On Thu, 17 Sep 1998, Glynn Clements wrote:
 
  -   if(n==25 || n==50)
  -   {
  -  printf("hit enter for the next page..\n");
  -  getchar();
  -   }
  - }
  -
  - but it didn't work, has anyone got a solution to my little problem?
  -
  -In what way didn't it work? If it never prints the message, then it's
  -due to something in the `//other functions' section.
 
 and consider resetting n to 0 after each screenful. That way you don't
 need to check for n==25 || n==50 || n==75.
 
 if (n  24) {
 printf ("Press enter for next page...\n");
 getchar();
 n=0; /* because we all know the screen really goes from 0-24 */
 }

 [subbaraom]  Why don't you use % (mod  opearator) in the following way
 if ((n % 25) == 0) {
 printf("Press enter for next page ... \n);
 getchar();
 }
  --
Good idea using the mod operator i think.
Does anyone know if there is a function getline() in C which acts like
the C++ iostream function  cin.getline(STRING, SIZE, DELIMITER); ?  
That way you could simply set the SIZE as 25+1 for null, right?

#include iostream.h
#define SIZE  25+1
#define TRUE  1
#define FALSE 0
void main()
{
  char test_str[SIZE];
  while(cin.eof != TRUE)
  {
cin.getline(test_str, SIZE, '\0'); //i think NULL
   //is the default delimiter?
cout  test_str;  //or whatever you wanted to do with it
  }
}

Sorry if any of this has been repeated or thrown out already, i just
jumped into this problem and i don't have the previous mails.

Best Regards,

Dan
UMCP