C++ deleting a pointer
The right way:
myPointer = new int;
delete myPointer; //freed memory
myPointer = NULL; //pointed dangling ptr to NULL
http://stackoverflow.com/questions/13223399/c-deleting-a-pointer
myPointer = new int;
delete myPointer; //freed memory
myPointer = NULL; //pointed dangling ptr to NULL
http://stackoverflow.com/questions/13223399/c-deleting-a-pointer
const volatile
will not be permitted to be changed by the code (an error will be raised due to the const
qualifier) - at least through that particular name/pointer.volatile
part of the qualifier means that the compiler cannot optimize or reorder access to the object.unsigned int const volatile *status_reg; // assume these are assigned to point to the
unsigned char const volatile *recv_reg; // correct hardware addresses
#define UART_CHAR_READY 0x00000001
int get_next_char()
{
while ((*status_reg & UART_CHAR_READY) == 0) {
// do nothing but spin
}
return *recv_reg;
}
If these pointers were not marked as being volatile
, a couple problems might occur:
- the while loop test might read the status register only once, since the compiler could assume that whatever it pointed to would never change (there's nothing in the while loop test or loop itself that could change it). If you entered the function when there was no character waiting in UART hardware, you might end up in an infinite loop that never stopped even when a character was received.
- the read of the receive register could be moved by the compiler to before the while loop - again because there's nothing in the function that indicates that
*recv_reg
is changed by the loop, there's no reason it can't be read before entering the loop.
The volatile
qualifiers ensures that these optimizations are not performed by the compiler.
tar -xvf fileName.tar
tar -xzvf fileName.tar.gz
Error: Unterminated character constant beginning at (1) aaa.f:4.72: print *, 'Try one of "Skip", "Test", "Verbosity" or "Cleanup" 1 Warning: Line truncated at (1) Fixed-form Fortran has only 72 characters per line. What happens with longer lines is implementation dependent. However, many programmers/programs assume that everything after column 72 is ignored (which gfortran does). Solution: Fix the program by splitting the line or by using the -ffixed-line-length-n (n is a non-negative integer).
FORMAT of the dollar symbol $ in order to remove the generation of a new line (Line Feed/Carriage Return),"
http://www.urz.uni-heidelberg.de/Dok/Fortran90forF77.html
"By defining a new data type or operator, and overloading operations and procedures (so that you can also use the plus + as the symbol of addition of intervals and not only of ordinary numbers)"http://www.urz.uni-heidelberg.de/Dok/Fortran90forF77.html
sudo apt-get install expectInstallation is done.
vi abc.sh
#!/usr/bin/expect -f set timeout 100 spawn ssh userid@servername expect "/home/devtrigger/.ssh/id_rsa" send "password\r" expect "servername:" send "bash\r" interact
http://devtrigger.blogspot.com/2012/02/install-expect-on-ubuntu-11.html
http://greg-n-blog.blogspot.com/search/label/ssh
http://stackoverflow.com/questions/12202587/ssh-script-that-automatically-enters-password
http://stackoverflow.com/questions/4780893/use-expect-in-bash-script-to-provide-password-to-ssh-command