On Sat, May 06, 2006 at 01:10:08PM +0300, Martin Vermeer wrote:
> char const * using_this_returned_value_is_undefined_behaviour()
> {
> char const * cdata = std::string("data").c_str();
> return cdata;
> }
>
> I think I understand this. The problem is that cdata is made to point to
> the start
On Sat, May 06, 2006 at 12:07:54AM +0200, Edwin Leuven wrote:
> Angus Leeming wrote:
> >LOL! I think You are. You've confused this with "const &"
>
> and to add to the confusion (at least mine):
>
> why don't i see any invalid behavior or crashes with my original (wrong)
> patch?
Because 'undef
On Sat, May 06, 2006 at 12:07:54AM +0200, Edwin Leuven wrote:
> Angus Leeming wrote:
> >LOL! I think You are. You've confused this with "const &"
>
> and to add to the confusion (at least mine):
>
> why don't i see any invalid behavior or crashes with my original (wrong)
> patch?
char const * u
Edwin Leuven <[EMAIL PROTECTED]> writes:
Angus> LOL! I think You are. You've confused this with "const &"
Edwin> and to add to the confusion (at least mine):
Edwin> why don't i see any invalid behavior or crashes
Edwin> with my original (wrong) patch?
The term is "undefined behaviour". Sometimes
Angus Leeming wrote:
LOL! I think You are. You've confused this with "const &"
and to add to the confusion (at least mine):
why don't i see any invalid behavior or crashes with my original (wrong)
patch?
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
Angus> Hmmm. How does your example differ from mine?
Angus> char const * using_this_returned_value_is_undefined_behaviour()
Angus> {
Angus> char const * cdata = std::string("data").c_str();
Angus> return cdata;
Angus> }
Angus> The lifetime of std:
Angus Leeming a écrit :
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
The temporary QCString object created as return value of 'fromUnicode'
will be destroyed at the end of the full expression, i.e. basically at
the semicolon in the first line.
No, it is a QByteArray and QByteArray::data() retur
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
> > The temporary QCString object created as return value of 'fromUnicode'
> > will be destroyed at the end of the full expression, i.e. basically at
> > the semicolon in the first line.
>
> No, it is a QByteArray and QByteArray::data() returns explici
Andre Poenitz a écrit :
On Fri, May 05, 2006 at 09:31:14PM +0200, Abdelrazak Younes wrote:
No it is char const * issue. I said remove the const and it will be all
right:
char * foo = codec->fromUnicode(str).data();
return foo[0];
This should work on VC++ and gcc.
This is undefined behaviou
On Fri, May 05, 2006 at 09:31:14PM +0200, Abdelrazak Younes wrote:
> No it is char const * issue. I said remove the const and it will be all
> right:
>
> char * foo = codec->fromUnicode(str);
> return foo[0];
>
> This should work on VC++ and gcc.
This is undefined behaviour.
The temporary QCS
Abdelrazak Younes a écrit :
char * foo = codec->fromUnicode(str);
make it rather :
char * foo = codec->fromUnicode(str).data();
This is a typo.
return foo[0];
This should work on VC++ and gcc. _But_ note that I didn't recommend
that, I recommended:
return codec->fromUnicode(str)[0];
Andre Poenitz a écrit :
On Thu, May 04, 2006 at 11:16:46PM +0200, Edwin Leuven wrote:
Andre Poenitz wrote:
On Thu, May 04, 2006 at 10:05:41AM +0200, Edwin Leuven wrote:
- Q3CString tmpstr = codec->fromUnicode(str);
- char const * tmpcstr = tmpstr;
+ char const * tmpcstr = cod
On Thu, May 04, 2006 at 11:16:46PM +0200, Edwin Leuven wrote:
> Andre Poenitz wrote:
> >On Thu, May 04, 2006 at 10:05:41AM +0200, Edwin Leuven wrote:
> >>- Q3CString tmpstr = codec->fromUnicode(str);
> >>- char const * tmpcstr = tmpstr;
> >>+ char const * tmpcstr = codec->fromUnicode(str).dat
On Thu, May 04, 2006 at 11:46:09PM +0200, Abdelrazak Younes wrote:
> fromUnicode return a temporary QByteArray; so is the internal char* that
> is returned by data(). So a const pointer will stay valid only during
> the current context (remember that char * is not a simple pointer in C
> and C++
Edwin Leuven wrote:
Abdelrazak Younes wrote:
Andre Poenitz wrote:
fromUnicode() returns a temporary object that will be destoyed at the
end of the full expression. So tmpcstr will be invalid after that.
Accessing tmpcstr[0] after that will cause invalid behaviour (and
almost
guaranteed a cra
Abdelrazak Younes wrote:
Andre Poenitz wrote:
fromUnicode() returns a temporary object that will be destoyed at the
end of the full expression. So tmpcstr will be invalid after that.
Accessing tmpcstr[0] after that will cause invalid behaviour (and almost
guaranteed a crash with the Qt4 equival
Edwin Leuven wrote:
Andre Poenitz wrote:
On Thu, May 04, 2006 at 10:05:41AM +0200, Edwin Leuven wrote:
-Q3CString tmpstr = codec->fromUnicode(str);
-char const * tmpcstr = tmpstr;
+char const * tmpcstr = codec->fromUnicode(str).data();
return tmpcstr[0];
}
fromUnicode() retu
Andre Poenitz wrote:
On Thu, May 04, 2006 at 10:05:41AM +0200, Edwin Leuven wrote:
- Q3CString tmpstr = codec->fromUnicode(str);
- char const * tmpcstr = tmpstr;
+ char const * tmpcstr = codec->fromUnicode(str).data();
return tmpcstr[0];
}
fromUnicode() returns a tem
On Thu, May 04, 2006 at 10:05:41AM +0200, Edwin Leuven wrote:
> - Q3CString tmpstr = codec->fromUnicode(str);
> - char const * tmpcstr = tmpstr;
> + char const * tmpcstr = codec->fromUnicode(str).data();
> return tmpcstr[0];
> }
fromUnicode() returns a temporary object that will
Angus Leeming a écrit :
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
Edwin> the attached works for me
Edwin> - Q3CString tmpstr = codec->fromUnicode(str);
Edwin> - char const * tmpcstr = tmpstr;
Edwin> + char const * tmpcstr = codec->fromUnicode(str).data();
Abdel> Maybe:
Abdel>
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
Edwin> the attached works for me
Edwin> -Q3CString tmpstr = codec->fromUnicode(str);
Edwin> -char const * tmpcstr = tmpstr;
Edwin> +char const * tmpcstr = codec->fromUnicode(str).data();
Abdel> Maybe:
Abdel> return codec->fromU
Edwin Leuven a écrit :
Abdelrazak Younes wrote:
// more tricky?
QLyXKeySym.C:#include
Maybe not.
the attached works for me
[...]
- Q3CString tmpstr = codec->fromUnicode(str);
- char const * tmpcstr = tmpstr;
+ char const * tmpcstr = codec->fromUnicode(str).data();
May
Abdelrazak Younes wrote:
// more tricky?
QLyXKeySym.C:#include
Maybe not.
the attached works for me
Index: src/frontends/qt4/QLyXKeySym.C
===
--- src/frontends/qt4/QLyXKeySym.C (revision 13796)
+++ src/frontends/qt4/QLyXKe
Abdelrazak Younes wrote:
Sorry, I don't have the time to review the patch but if you say you have
tested it and it works I trust you :-)
i of course tested it and found no issues (not that i am infallible
though... ;-)
it is in. thanks
ed.
Edwin Leuven a écrit :
patch attached
this is what is left:
// pref dialog
QPrefColorsUi.ui: q3listbox.h
qcoloritem.h:#include
QPrefConvertersUi.ui: q3listbox.h
QPrefCopiersUi.ui: q3listbox.h
QPrefFileformatsUi.ui: q3listbox.h
QPrefsDialog.C: Q3ListBoxItem * const item =
// more t
patch attached
this is what is left:
// pref dialog
QPrefColorsUi.ui: q3listbox.h
qcoloritem.h:#include
QPrefConvertersUi.ui: q3listbox.h
QPrefCopiersUi.ui: q3listbox.h
QPrefFileformatsUi.ui: q3listbox.h
QPrefsDialog.C: Q3ListBoxItem * const item =
// more tricky?
QLyXKeySym.C:#in
26 matches
Mail list logo