backwards-compatibility

Should I use _T or _TEXT on C++ string literals?

一笑奈何 提交于 2019-11-30 05:50:45
For example: // This will become either SomeMethodA or SomeMethodW, // depending on whether _UNICODE is defined. SomeMethod( _T( "My String Literal" ) ); // Becomes either AnotherMethodA or AnotherMethodW. AnotherMethod( _TEXT( "My Text" ) ); I've seen both. _T seems to be for brevity and _TEXT for clarity. Is this merely a subjective programmer preference or is it more technical than that? For instance, if I use one over the other, will my code not compile against a particular system or some older version of a header file? A simple grep of the SDK shows us that the answer is that it doesn't

In C++, why struct is in fact class?

五迷三道 提交于 2019-11-30 05:41:08
问题 The other topic and responses there made me ask this question: Why does C++ allow struct to behave just like class ? At one hand, C++ made it compatible with C-struct by making it's members public by default (just like in C), while on the other hand, it made it look-like class by allowing it to be inherited from classes, and applying other object-oriented techniques (not so much like C-struct anymore). Why did it not make it just plain old C-struct with no OOP? Any special reason? 回答1: From a

ISerializable and backward compatibility

廉价感情. 提交于 2019-11-30 05:06:17
问题 I have to work an an old application that used binaryFormatter to serialize application data into filestream (say in a file named "data.oldformat") without any optimizazion the main class has been marked with attribute <serializable()>public MainClass ....... end class and the serialization code dim b as new binaryformatter b.serialize(mystream,mymainclass) In an attempt to optimize the serialization/deserialization process I simply made the class implement the ISerializable interface and

Android X backwards compatibility

旧街凉风 提交于 2019-11-30 04:46:35
问题 I have Android App that uses support library versions 27.1.2. I want to consume a library written using Android X (api 28). There are few issues with name spacing of the library versions. Example ... The library has a Dialog that I want to use with the api Dialog.show(androidx.fragment.app.FragmentActivity activity); However all my activities are using android.support.v4.app.FragmentActivity and the compiler does not like this. Currently it is not an option to upgrade my project to latest

Compiling Java code written for 1.5 to work with 1.4 JRE?

狂风中的少年 提交于 2019-11-30 03:58:10
问题 I have a project that uses generics and a few Java 1.5/6 bits and pieces. Is it possible to compile this code to work on a system running a 1.4 JRE? I use an ANT build script and javac task to compile the library. This builds fine while the target attribute is 1.5. If I change the target to be 1.4 I get the following error: generics are not supported in -source 1.4 (use -source 5 or higher to enable generics) So I add a source attribute and try a value of 5 and 1.5. New error: javac: source

Java 6 Source backward-compatibility and SQL

…衆ロ難τιáo~ 提交于 2019-11-30 02:24:10
My understanding is that in order to maintain source-compatibility, Java never introduces new methods to public interfaces, as that breaks existing clients implementing the interfaces. Java Release notes states In general, the policy is as follows, except for any incompatibilities listed further below: Maintenance releases (such as 1.4.1, 1.4.2) do not introduce any new language features or APIs. They will maintain source-compatibility with each other. Functionality releases and major releases (such as 1.3.0, 1.4.0, 5.0) maintain upwards but not downwards source-compatibility. Yet, the

Visual Studio won't open solution file

前提是你 提交于 2019-11-30 02:10:28
I have a VS project (made by someone else), and when I try to open it on Visual Studio 2008, I get the following error message: "The selected file is a solution file, but was created by a newer version of this application and cannot be opened" I would have thought VS was backwards compatible. Is there any way I can open this? VS is backwards compatible, yes - you can open a VS 2005 solution file in VS 2008, for example. It's not forward compatible though - presumably that solution has been created by someone with VS 2010. EDIT: According to comments, with VS2010 SP1, you can open VS2012

Replacing fragments and orientation change

﹥>﹥吖頭↗ 提交于 2019-11-30 01:52:19
I'm developing an Android application targeting 2.x and 3.0 devices and thus I'm using the compatibilty API. I'm testing on Android 2.0. I'm trying to replace a displayed fragment with another one (search form with search results) and I'm experiencing a crash on orientation change when the second (results) fragment is displayed. Basically, I have an activity, that includes a fragment defined in layout xml as <fragment class="org.prevoz.android.search.SearchFormFragment" android:id = "@+id/search_form_fragment" android:layout_width = "fill_parent" android:layout_height = "fill_parent" /> The

How to warn about class (name) deprecation

左心房为你撑大大i 提交于 2019-11-29 23:34:15
I have renamed a python class that is part of a library. I am willing to leave a possibility to use its previous name for some time but would like to warn user that it's deprecated and will be removed in the future. I think that to provide backward compatibility it will be enough to use an alias like that: class NewClsName: pass OldClsName = NewClsName I have no idea how to mark the OldClsName as deprecated in an elegant way. Maybe I could make OldClsName a function which emits a warning (to logs) and constructs the NewClsName object from its parameters (using *args and **kvargs ) but it doesn

How should I write my C++ to be prepared for C++ modules?

旧街凉风 提交于 2019-11-29 21:14:31
There are already two compilers that support C++ modules: Clang: http://clang.llvm.org/docs/Modules.html MS VS 2015: http://blogs.msdn.com/b/vcblog/archive/2015/12/03/c-modules-in-vs-2015-update-1.aspx When starting a new project now, what should I pay attention to in order to be able to adopt the modules feature when it is eventually released in my compiler? Is it possible to use modules and still maintain compatibility with older compilers that do not support it? There are already two compilers that support C++ modules clang: http://clang.llvm.org/docs/Modules.html MS VS 2015: http://blogs