Tur donusumleri
dynamic_cast
static_cast
reinterpret_cast
const_cast
Etiketler: CPP
RedHat, Uygulama Kurulumu, Ayarlar vs.
Yeni Mac Office'de formulun ucunda cift tiklamak ise yaramiyor utun sutuna ayni formulu uygulamam icin. Asagidaki ilk oneri super.
1 - Enter A10000 in the Name box and hit enter to select A10000.
2 - Scroll up to A1
3 - Hold the shift key while clicking A1 to select A1:A10000.
4 - Type your formula into the formula bar
5 - Hold the Ctrl key and hit enter.
Or,
Enter the formula in A1 and drag it down to A10000.
Or use this code:
Sub FormulaTenK()
Range("A1:A10000").Formula = "=B1*6"
End Sub
Etiketler: Excel
Etiketler: SUSE
#include "ConfigException.h"
void test(int t) throw(ConfigException)
{
if (t==4)
{
throw ConfigException("t cannot be 4");
}
}
int main(int argc, char* argv[])
{
try{
if(argc>1){
int input = atoi(argv[1]);
test(input);
}
}
catch (ConfigException& ce) {
cerr<<"Reason: "<< ce.what <<endl;
exit(8);
}
catch (...) {
cerr<<"Unknown error"<<endl;
exit(8);
}
return(0);
}
Etiketler: CPP
#include <iostream>
#include <cstdlib>
using namespace std;
class ConfigException{
public:
const string what;
ConfigException(const string & i_what): what(i_what){}
};
Etiketler: CPP
Etiketler: API
Etiketler: CPP
ostream & operator << (ostream & out, const IntCell & rhs)
{
out << "value=" << rhs.read();
return out;
}
friend ostream &operator<<(ostream &stream, IntCell & ob);
istream &operator>>(istream &stream, IntCell &ob);
Etiketler: CPP
#include <vector>
#include <iostream>
using namespace std;
/**
* Return the maximum of an array
* Assumes a.size() > 0
* Comparable objecs must provide operator< and operator=
*/
template <typename Comparable>
const Comparable & findMax(vector<Comparable> &a)
{
int maxIndex = 0;
for (int i=0; i < a.size(); i++)
if(a[maxIndex] < a[i] ) //operator < burada gerekli
maxIndex = i;
return a[maxIndex]; //operator= burada kullanilacak
}
int main()
{
vector<int> v1(7);
for (int i=0; i < v1.size(); i++)
v1[i] = i;
cout<< findMax(v1) << endl;
return 0;
}
Etiketler: CPP
Etiketler: Open Solaris
nm
to extract the symbol table from a sample program named initcell
produces the following output:"Etiketler: CPP
Etiketler: CPP
Etiketler: GDB
#include <iostream>
#include "IntCell.h"
int main(){
IntCell a = IntCell(2);
IntCell b = a; //copy constructor
IntCell c; //copy assigment operator
c=b;
a.write(4);
std::cout << a.read() << std::endl << b.read() << std::endl <<c.read() << std::endl;
return 0;
}
Etiketler: CPP
IntCell.h:
#Bu hatali bir program. Amacim debug islemini ogrenmek
#ifndef _INTCELL_H_
#define _INTCELL_H_
class IntCell
{
public:
/**
* C++ eger tek bir constructor argumani varsa su sekilde yazilima izin veriyor:
* IntCell i = 6;
* Burada derleyici otomatik olarak temp bir IntCell yaratiyor. Atamayi yapiyor ve
* gecici degiskeni yok ediyor.
* explicit kelimesi bunu engellemek icin.
* Sadece IntCell i = IntCell(6);
* ya da IntCell i(6); diyerek yeni bir nesne yaratilabilir.
*/
explicit IntCell(int initValue=0)
{
storedValue = new int(initValue);
}
/**
* Destructor: use delete because the data stored is dynamically allocated
* using new
*/
~IntCell()
{
delete storedValue;
}
/**
* Bu iki IntCell nesneyi karsilastirmak icin
* Ileride verilen findMax icin gerekli bir operator
*/
bool operator<(const IntCell &rhs)
{
return *storedValue < *rhs.storedValue;
}
/**
* Copy assignment operator =
* This is applied to two objects after they have both been constructed
* lhs=rhs is intended to copy the state of rhs to lhs by default
*/
const IntCell & operator=(const IntCell &rhs)
{
if( this != &rhs)
{
storedValue = new int(*(rhs.storedValue));
}
return *this;
}
/**
* Copy constructor
* This constructor is called
* a - when a declaration with initialization is called , but not A=B (this is assignment op)
* b - an object is passed using call by value (instead of by & or const &)
* c - an object returned by value (instead of by & or const &)
*/
IntCell(const IntCell & rhs)
{
*storedValue = *(rhs.storedValue);
}
/**
* Read the stored value: accessor
*/
int read() const
{
return *storedValue;
}
/**
* Change the stored value: mutator
*/
void write(int x)
{
*storedValue = x;
}
private:
int *storedValue;
};
#endif
Etiketler: CPP
# gcore `pgrep CCtest`
gcore: core.1478 dumped
# mdb core.1478
Loading modules: [ libc.so.1 ld.so.1 ]
> main::dis
main: pushl %ebp
main+1: movl %esp,%ebp
main+3: subl $0x38,%esp
main+6: movl %esp,-0x2c(%ebp)
main+9: movl %ebx,-0x30(%ebp)
main+0xc: movl %esi,-0x34(%ebp)
main+0xf: movl %edi,-0x38(%ebp)
main+0x12: pushl $0x8
main+0x14: call -0x2e4
main+0x19: addl $0x4,%esp
main+0x1c: movl %eax,-0x10(%ebp)
main+0x1f: movl -0x10(%ebp),%eax
main+0x22: pushl %eax
main+0x23: call +0x1d5 <__1cjtestclass2t5b6m_v_>
Etiketler: DTrace
Etiketler: CPP
Etiketler: Java
Etiketler: CPP