|
|
This thread is locked; no one can reply to it.
|
1
2
|
| [Rant] Lost faith in Trolltech |
|
axilmar
Member #1,204
April 2001
|
I completely lost my trust in Qt these last few days. The amount of hacks and memory errors contained in the version my company had purchased (3.0.5 Windows) is phenomenal. Our client was complaining about crashes, so I had a look at the debug version using a special verification tool, and I found some hair-raising things, totally unexpected from a professional developer like Trolltech. For example, they have an internal function to convert a string from char* to TCHAR*. This function allocates a TCHAR buffer on the heap, and never frees it! The internal documentation says that each time this function is called, the buffer is reallocated, but this actually does not happen. I hope they have improved their coding with Qt 4. |
|
Jakub Wasilewski
Member #3,653
June 2003
|
axilmar said: For example, they have an internal function to convert a string from char* to TCHAR*. This function allocates a TCHAR buffer on the heap, and never frees it! The internal documentation says that each time this function is called, the buffer is reallocated, but this actually does not happen. Ohmegod! A memory leak! That never happens to professionals! --------------------------- |
|
SiegeLord
Member #7,827
October 2006
|
Jakub Wasilewski said: Ohmegod! A memory leak! That never happens to professionals! Considering that Qt is consistently and repeatedly touted as the best thing since sliced bread, such frustration is warranted. As OP shows, it's clearly not... not that that will deter the fanboys that will start trolling this thread imminently. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
|
Jakub Wasilewski
Member #3,653
June 2003
|
SiegeLord said: Considering that Qt is consistently and repeatedly touted as the best thing since sliced bread I'm pretty sure nobody sane would claim even a moderately complex library (let alone a behemoth like Qt) bug-free. I'm not a Qt fan (used it quite a few times, liked it, but that's it), but you have to accept that a big piece of software will have bugs. Especially if you are talking about an older version. I might be wrong, but Qt 3.0.5 sounds a bit ancient - Qt4 was released in 2005, I think. Still, I can understand the pain. It's always annoying when you are looking for an obscure bug in your code, and after seven hours it turns out that something that is usually completely trusted (like the library/compiler) is at fault. --------------------------- |
|
axilmar
Member #1,204
April 2001
|
Actually, the example I offered was in a trivial function...a function that simply converted one string to another. The problem was that the function was used all over the place! I simply did not expect something like that from Trolltech. |
|
le_y_mistar
Member #8,251
January 2007
|
edit ----------------- |
|
X-G
Member #856
December 2000
|
Converting strings between formats is an extremely ubiquitous piece of code and you'd think they would have discovered any problems -- especially as glaring as this -- early on. Guess they're not the messiah after all... -- |
|
Arthur Kalliokoski
Second in Command
February 2005
|
Maybe the programmers are running wild, and none of them wants to fix bugs in such mundane code, they all want to work on the sexy new stuff. That reminds me of another company too... They all watch too much MSNBC... they get ideas. |
|
Wetimer
Member #1,622
November 2001
|
Well... At work we use 3.3, and so 3.0.5 must be really old. While they should have caught that, it might not be the best to judge the quality of the software based on an old release especially one with a zero in the version number. That said, the code is a bit of a mixed bag. Some of it is rather scary. <code>if(Windows.State = Crash) Computer.halt();</code> |
|
Thomas Harte
Member #33
April 2000
|
That's a shame since in terms of features, QT seems to be substantially ahead of the crossplatform competition. Here on the Mac, recentish applications built with QT use the native widgets and look odd only on account of placement and sizing differences. GTK+ applications run in X11 and look like X11 applications as used by people who left FreeType on the default settings — all the text is spindly and angular and I've no idea what's going on with the glyph placement. And various things seem to be the wrong sizes, such as the window displaying object scale in Inkscape chopping off everything after the first two digits. If objects are full size they are scale "10", if they're halfsize then they're scale "50" and if they're 1/20th size then they're scale "5%". [My site] [Tetrominoes] |
|
Thomas Fjellstrom
Member #476
June 2000
|
I've never claimed Qt to be perfect. But it is FAR better than the alternatives imo. -- |
|
Matthew Leverton
Supreme Loser
January 1999
|
You should see all of the memory leaks in my GUI. |
|
GullRaDriel
Member #3,861
September 2003
|
It's a licking library ? "Code is like shit - it only smells if it is not yours" |
|
ImLeftFooted
Member #3,935
October 2003
|
That's a pretty serious error... Even more so because the docs say the proper solution while the reality is very different. |
|
BAF
Member #2,981
December 2002
|
Ah, trusty old C++. Why the hell are they using char* and TCHAR* anyway? What's wrong with std::string and family? |
|
ImLeftFooted
Member #3,935
October 2003
|
One time during an interview I was asked to do a string reversal in C++. I wanted to laugh at them. #include <string> #include <algorithm> using namespace std; string revStr(string s) { reverse(s.begin(), s.end()); return s; }
I ended up doing it in C, which is a more challenging project. |
|
Matthew Leverton
Supreme Loser
January 1999
|
|
|
Thomas Harte
Member #33
April 2000
|
Oooh, an in-place reversal. Fancy. [My site] [Tetrominoes] |
|
james_lohr
Member #1,947
February 2002
|
Dustin Dettmer said: One time during an interview I was asked to do a string reversal in C++. I wanted to laugh at them. I was asked the same thing in an interview. I also cheated, doing it by pushing the string onto a stack and then popping it off again. I was then asked for a more efficient way of doing it, to which I answered : "I'd normally do it in plain C by looping half way through the string and swapping values (using a single temporary value), but I chose to use a stack because I'd likely make a silly little error somewhere given the pressure of the interview if I was to do it by looping" The interviewer replied with: "that's fine, but can you think of an even faster way of doing it?". My answer was : "well, it's probably not more efficient, but there is a nasty little trick using XOR to swap value without using a temporary value". The interviewer then responded with "No, not like that. What I meant was, you could swap the pointers instead".
|
|
ImLeftFooted
Member #3,935
October 2003
|
James Lohr said: The interviewer then responded with "No, not like that. What I meant was, you could swap the pointers instead". Ah! |
|
Ron Novy
Member #6,982
March 2006
|
Here's the completely over the top and unnecessary GCC style 32-bit assembly version (Compile with "-x assembler-with-cpp" option)... But it's pretty fast on long strings 1* readable way to access arguments passed from C code */
2#define ARG1 8(%ebp)
3#define ARG2 12(%ebp)
4#define ARG3 16(%ebp)
5#define ARG4 20(%ebp)
6
7/* helper macros in case we ever need to change these */
8#define _align_ .balign 4, 0x90
9#define FUNC(name) .globl _##name ; _align_ ; _##name:
10#define GLOBL(name) _##name
11
12/* void mem_reverse(char* ptr, unsigned long size);
13 * reverses the block of SIZE bytes pointed to by PTR.
14 */
15FUNC(mem_reverse)
16 pushl %ebp
17 movl %esp, %ebp
18 pushl %edi
19 pushl %esi
20 pushl %edx
21 pushl %ecx
22 pushl %eax
23
24 /* get input parameters */
25 movl ARG1, %esi
26 movl ARG2, %ecx
27 std /* %edi gets decremented while %esi gets incremented */
28
29 /* set %edi to the last byte in the buffer */
30 movl %esi, %edi
31 addl %ecx, %edi
32 decl %edi
33
34 /* cut %ecx in half */
35 shrl $1, %ecx
36
37 /* short byte loop or long loop */
38 cmpl $7, %ecx
39 jle mem_rev_byte_loop
40
41 /* align to %esi bit 0 */
42 testl $1, %esi
43 jz mem_rev_align0
44 movb (%edi), %al
45 xchgb (%esi), %al
46 stosb
47 incl %esi
48 decl %ecx
49mem_rev_align0:
50
51 /* align to %esi bit 1 */
52 decl %edi /* adjust %edi since it moves backwards */
53 testl $2, %esi
54 jz mem_rev_align1
55 movw (%edi), %ax
56 xchgb %ah, %al
57 xchgw (%esi), %ax
58 xchgb %ah, %al
59 stosw
60 addl $2, %esi
61 subl $2, %ecx
62mem_rev_align1:
63
64 /* setup the long loop */
65 movb %cl, %dl /* save the lower bits of the counter */
66 shrl $2, %ecx /* divide by 4 */
67 subl $2, %edi /* adjust %edi since it moves backwards */
68
69 /* do the loop */
70mem_rev_long_loop:
71 movl (%edi), %eax
72 bswap %eax
73 xchgl (%esi), %eax
74 bswap %eax
75 stosl
76 addl $4, %esi
77 decl %ecx
78 jnz mem_rev_long_loop
79
80 /* now restore the lower bits we saved in dl and finish off the last bytes */
81 movb %dl, %cl
82 andb $3, %cl
83 addl $3, %edi
84
85 /* now reverse the bytes */
86mem_rev_byte_loop:
87 movb (%edi), %al
88 xchgb (%esi), %al
89 stosb
90 incl %esi
91 decl %ecx
92 jnz mem_rev_byte_loop
93
94 /* thats all folks */
95mem_rev_exit:
96 cld
97 popl %eax
98 popl %ecx
99 popl %edx
100 popl %esi
101 popl %edi
102 movl %ebp, %esp
103 popl %ebp
104 ret
---- |
|
Thomas Fjellstrom
Member #476
June 2000
|
Are the prefix underscores REALLY necessary? Only outmoded systems require them anymore. -- |
|
axilmar
Member #1,204
April 2001
|
WTF...The function QString::printf has a static ptr to a QRegExp...I used QString in multiple threads and my program crashed hopelessly and randomly. Then I found the static QRegExp, for which the Qt docs say: Quote: QRegExp uses a static cache and is not threadsafe at all, even if the QRegExp object is protected by using QMutex. Nice one, Trolltech. QString can effectively be used from the main thread only. Really nice...I now have to replace QString with String everywhere in the project, and code my String class which has the same API as QString. EDIT: Many thanks also to the C++ committee for not providing sane string classes along the STL... |
|
Oscar Giner
Member #2,207
April 2002
|
Maybe you should upgrade to a newer version of Qt. Qt 3.0.5 is really old (more than 7 years old to be specific). Qt 4 doesn't have any of the issues you've described. -- |
|
Thomas Fjellstrom
Member #476
June 2000
|
Indeed. Using Qt 3 is like continuing to use Windows 98 or 95. -- |
|
|
1
2
|