⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pretty3.c

📁 this is a gcc file, you can download it and learn its usetility, for further detail please look at t
💻 C
字号:
// Copyright (C) 1999 Free Software Foundation, Inc.// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in templates#include <stdio.h>#include <string.h>static bool bad = false;template<class T> void f1 (T){  char const *function = __FUNCTION__;  char const *pretty = __PRETTY_FUNCTION__;    printf ("generic\n");  printf ("__FUNCTION__ %s\n", function);  printf ("__PRETTY_FUNCTION__ %s\n", pretty);    if (strcmp (function, "f1"))    bad = true;  if (strcmp (pretty, "void f1(T) [with T = float]")) // only for float instantiation    bad = true;}template<> void f1<int> (int){  char const *function = __FUNCTION__;  char const *pretty = __PRETTY_FUNCTION__;    printf ("specialized\n");  printf ("__FUNCTION__ %s\n", function);  printf ("__PRETTY_FUNCTION__ %s\n", pretty);    if (strcmp (function, "f1"))    bad = true;  if (strcmp (pretty, "void f1(T) [with T = int]"))    bad = true;}int main (){  f1(0);    // f1<int>  f1(0.0f); // f1<float>  return bad;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -